☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Add Line plot conditional line_color functionality

Community Support
joshua.t.dunn
joshua.t.dunn

It would be very handy to be able to have conditional line colouring for a line plot in Bokeh.

It is supported for circle plots and other similar plots for the fill and line colour options.

Please see this issue on GitHub for further details.

⌁   Link to post
Bryan
Bryan

Hi,

It's not clear what you are asking for. Line and circle are topologically very different. If you have a ColumnDataSource with columns of length 10, and you use it with Circle, then you get 10 circles drawn, and if you use a color mapper with that, then it color maps each value from some column and applies 10 different colors, one to each of the circles. But Line is not like that, The columns have 10 values in then, but only one line gets drawn. What is the actual goal in that case?

* Do you want to use the multiple values in the column to make a single "rainbow" line? i.e.that starts green at one end and orange at the other? If so, that is not supported by the underlying browser HTML canvas, so it's not supported by Bokeh either. It's possible you could write a custom extension to draw something like that.

* Otherwise, what does it mean to take a column of 10 values and use all 10 to color one line? There's not a generally meaningful interpretation of that. Maybe you have some specific use case where it makes sense to take a whole array of numbers and turn it in to one color or one like but that is something too specialized for a general library.

Alternatively, are you trying to draw multiple lines at once? Then you can use multi_line instead of line:

  https://bokeh.pydata.org/en/latest/docs/user_guide/plotting.html#multiple-lines

In that case it does make sense to apply a color mapper, because the mapper can generate 10 colors (just like with Circle, etc) and us one color for each of the multiple lines.

Thanks,

Bryan

···

On Jun 15, 2018, at 07:28, joshua.t.dunn@gmail.com wrote:

It would be very handy to be able to have conditional line colouring for a line plot in Bokeh.

It is supported for circle plots and other similar plots for the fill and line colour options.

Please see this issue on GitHub for further details.

--
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/19e77f5f-eacd-42b8-af50-e6cb0fdb2f17%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Parikshit_Bhinde
Parikshit_Bhinde

I’ve had a question related to applying a color map to a set of lines which has been answered here:

https://stackoverflow.com/questions/50192139/bokeh-apply-color-map-to-set-of-lines

···

On Friday, 15 June 2018 20:38:36 UTC+5:30, Bryan Van de ven wrote:

Hi,

It’s not clear what you are asking for. Line and circle are topologically very different. If you have a ColumnDataSource with columns of length 10, and you use it with Circle, then you get 10 circles drawn, and if you use a color mapper with that, then it color maps each value from some column and applies 10 different colors, one to each of the circles. But Line is not like that, The columns have 10 values in then, but only one line gets drawn. What is the actual goal in that case?

  • Do you want to use the multiple values in the column to make a single “rainbow” line? i.e.that starts green at one end and orange at the other? If so, that is not supported by the underlying browser HTML canvas, so it’s not supported by Bokeh either. It’s possible you could write a custom extension to draw something like that.

  • Otherwise, what does it mean to take a column of 10 values and use all 10 to color one line? There’s not a generally meaningful interpretation of that. Maybe you have some specific use case where it makes sense to take a whole array of numbers and turn it in to one color or one like but that is something too specialized for a general library.

Alternatively, are you trying to draw multiple lines at once? Then you can use multi_line instead of line:

    [https://bokeh.pydata.org/en/latest/docs/user_guide/plotting.html#multiple-lines](https://bokeh.pydata.org/en/latest/docs/user_guide/plotting.html#multiple-lines)

In that case it does make sense to apply a color mapper, because the mapper can generate 10 colors (just like with Circle, etc) and us one color for each of the multiple lines.

Thanks,

Bryan

On Jun 15, 2018, at 07:28, joshua...@gmail.com wrote:

It would be very handy to be able to have conditional line colouring for a line plot in Bokeh.

It is supported for circle plots and other similar plots for the fill and line colour options.

Please see this issue on GitHub for further details.

–
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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/19e77f5f-eacd-42b8-af50-e6cb0fdb2f17%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post

End of archived discussion · Replies are disabled