Can't update multi_line datasource dynamically
See original GitHub issueI have the following code to update a multi-line plot dynamically:
xs, ys = get_xs_ys_for(event)
source = ColumnDataSource(dict(xs=xs, ys=ys))
def ticker_change(attrname, old, new):
xs, ys = get_xs_ys_for(new)
source.data = dict(x=xs, ys=ys)
ticker.on_change('value', ticker_change)
fig = figure(title='Individual Lines', height=450)
plot = fig.multi_line(xs, ys, source=source, line_width=5, line_color=Spectral11)
However, the update is not reflected in the multi-line plot when I change the ticker (it keeps the old lines). I’m wondering if it is a bug (because it works with one line (using fig.line())?
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Updating multiple line plots dynamically in callback in bokeh
I am guessing because in the new data source, the pay_conv_7d.content column doesn't exist, but in my plot those lines were already there....
Read more >Power Automate: Add and update data in bulk - YouTube
Your browser can't play this video. ... Then you modify the flow to also update existing items and create new ones.
Read more >Multi Line Chart Functionality - Ext.NET Forums
Hello, I am trying to create a multi-line chart and the existing functionality doesn't seem to support how I want to produce the...
Read more >How Analysis Works for Multi-table Data Sources that Use ...
Using a data source that has multiple, related tables affects how analysis works in Tableau. Because multiple, related tables have independent domains and ......
Read more >How to use Dynamic SQL in BigQuery - Towards Data Science
So, you can't pass in a column name through USING. Hence, I recommend using String FORMAT() to create the query to execute immediately...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can set the line color but you need to put the colors in the
source
. Behaviours like this are why this mixed list literal / explicit source usage is being disallowed. In brief the problem is this: the original glyph method call constructs a column forline_color
but your update function only has x and y columns. So then the plot looks for a (now non-existent) column for line color, and breaks.Right. OK that was the point I was trying to make I just missed the line_color thing being wrong too.
So this is wrong:
plot = fig.multi_line(xs, ys, source=source, line_width=5, line_color=Spectral11)
this is wrong:
plot = fig.multi_line(xs='xs', ys='ys', source=source, line_width=5, line_color=Spectral11)
this is right:
plot = fig.multi_line(xs='xs', ys='ys', source=source, line_width=5, line_color='color')
ALTERNATIVELY
You could do this which pulls the source that’s been created for you out: