Adjust alpha for Line chart

I’d like to change the alpha for a Line chart.

This example doesn’t work (AttributeError)

from bokeh.sampledata.autompg import autompg
from bokeh.charts import Line, show, output_notebook

pl = Line(autompg, x=‘yr’, y=‘weight’, alpha=.1)


I see similar args like border_fill_alpha and outline_line_alpha, but none of these seem to do what I’m expecting.

Do I need to do the lower-level pline.line(x, y, alpha=.1) in a for loop to use alpha with lines?


Hi, there was a recent discussion about this on the Gitter channel, I’ll quote the relevant response:

There is definitely a trade-off in terms of ease of customizability with charts (does more for you up front but exposes less knobs and dials, fairly common trade off). I think there is an open issue for adding an alpha param to some of the charts. This would be a good task for a new contributor since it’s pure python. In the mean time, you can either use bokeh.plotting as you say, or you can set the alpha on the glyhph(s) by hand. To do that: look at p1.renderers for your Line chart, and find all the GlyphRenderer instances, for each of those, set .glyph.alpha to 0.1 or whatever.

After the discussion there, the user expressed interest in working up a PR to add alpha to charts where it makes sense. We’d certainly be happy to provide help and guidance for any new contributors that want to work on this.