Why is Bokeh so inconsistent with it's ability to use a ColumnDataSource?

I have observed on a number of occasions that Bokeh only intermittently picks up a column from a column data source for plotting. My latest example of this is replicated below:

from bokeh.plotting import figure, show
from bokeh.models import ColumnDataSource

cds = ColumnDataSource({
        'xs': [[0, 0, 1, 1], [2, 2, 3, 3]],
        'ys': [[0, 1, 1, 0], [2, 3, 3, 2]],
        'line_color': ['red', 'blue'],
        'line_dash': ['solid', 'dashed']

p = figure(title = 'Test')
p.patches(xs = 'xs', ys = 'ys', line_width = 2, line_color = 'line_color', line_dash = 'line_dash', fill_color = None, source = cds)    # line_dash will throw an error but line_color does not?

Looking at the documentation for patches I can’t see any obvious reason why line_dash is not supported when line_color is? Is there anywhere I can find out for each glyph type what will be picked up for a column data source and what will not?

line_color is ColorSpec, line_dash is DashPattern.
What each of the types accepts can be seen in their respective documentation:

If you have an idea on how to improve the documentation or make the distinction more obvious, please create a feature request on GitHub with all details at https://github.com/bokeh/bokeh/issues

Thank you @p-himik. The documentation is indeed clear now that I have read it, to be honest I normally just look at the calling object because I didn’t realise there was more detail underneath.

I suppose I am more interested in the why? Why can patches have different line colours but not dash styles? The distinction seems arbitrary.

it was a very early decision (~8 years ago) there was probably some uninteresting technical reason for it at the time, but I don’t recall any of the actual details. More importantly (and relevantly to today) having multiple dash styles is just (evidently) not a thing very many people ever want to do. I think you are the second person to have asked about it in all this time. Accordingly, no one has ever priortized putting any effort into changing the status quo around it.

I guess I would add: the distinction between “vector” and “scalar” properties is better delineated these days, so if someone wanted to work on this to add it in the places it would make sense (i.e. the “multi” glyphs and some annotations) then I expect it could be done fairly straightforwardly. It would be a good first issue for a new contributor.

It’s maybe not quite as trivial a change as I had thought (which is probably related to why it was not supported in the first place) but here is an issue placed for anyone who ever wants to work on it:


Thanks @Bryan. I’d love to help with the issue you raised, but unfortunately I’d need quite a bit of help to get started. I’ve never contributed to another project like this before.

I did a little bit of digging myself but before long I feel like I’m drowning in stuff I don’t understand, it’s overwhelming.

Well, we are always happy to help new folks get involved, and there’s also certainly no rush or deadline so things can always happen at whatever pace is convenient. In any case if you did decide you wanted to work through this issue (with help) then the first place to start is to go through the Developer’s Setup Guide.