set color of Bokeh line plot with columndatasource

I posted this to stackoverflow, (python - Bokeh line plot color in ColumnDataSource - Stack Overflow) but figured maybe I would get a faster response here.

I would like to set the color of a Bokeh line plot (Bokeh version 0.12.5) using a ColumnDataSource. However, with a line plot nothing is plotted. On the other hand, if I use a circle renderer everything works
as expected. I attached an example program with both a line plot and a circle plot and you can comment/uncomment the appropriate lines to see the plotting behavior. I also included a line of code for a line plot where the color is explicitly defined and the plot works perfectly. I have seen a couple similar questions asked but could not find a solid solution to this problem or determine if I am just doing something fundamentally wrong. Thanks for your help.

line_plot_color.py (718 Bytes)

Hi,

My understanding of your question is that you are looking to draw a single (multi-)line with different colors all along it? There is nothing currently in Bokeh that supports this use-case directly. To do this I can only think of a few options:

* draw individual line segments with the different colors you want (e.g. with multiple calls to line, or with data arranged for a single call to segments or multi_line) One drawback to this approach is that there will not be nice line joins where the individual segments meet.

* create a custom extension to Bokeh to support this. Information about extensions is here: http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html#

Thanks,

Bryan

ยทยทยท

On Jun 19, 2017, at 22:24, cuxcrider <[email protected]> wrote:

I posted this to stackoverflow, (python - Bokeh line plot color in ColumnDataSource - Stack Overflow) but figured maybe I would get a faster response here.

I would like to set the color of a Bokeh line plot (Bokeh version 0.12.5) using a ColumnDataSource. However, with a line plot nothing is plotted. On the other hand, if I use a circle renderer everything works as expected. I attached an example program with both a line plot and a circle plot and you can comment/uncomment the appropriate lines to see the plotting behavior. I also included a line of code for a line plot where the color is explicitly defined and the plot works perfectly. I have seen a couple similar questions asked but could not find a solid solution to this problem or determine if I am just doing something fundamentally wrong. Thanks for your help.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/ce90debd-f782-438a-ada7-c37be921c5e2%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
<line_plot_color.py>