Reputation: 753
In Matplotlib the legend function has a keyword argument called fancybox that makes the legend slightly transparent to see the lines behind the legend. Here is an example function call:
import matplotlib.pyplot as plt
plt.legend(fontsize='xx-small', loc='best', fancybox=True)
I can't find anything similar to this in Bokeh. Does anyone know if Bokeh has the functionality to make a plot transparent without going behind the scenes and monkey patching something in for it? Thanks.
Upvotes: 4
Views: 5752
Reputation: 7796
Judging by this one example in the documentation, I think you can change the legend transparency setting the plot.legend.border_line_alpha
, which changes the transparency of the border line and also the legend itself, apparently.
http://docs.bokeh.org/en/latest/docs/user_guide/styling.html#id2
Upvotes: 4
Reputation: 34568
(As of Bokeh 0.9.2) Configuring the legend background was only just added a few weeks ago in a recent PR. It will be in the upcoming 0.9.3 release at the end of August 2015.
A final note, Just FYO: due to the cross-language nature of Bokeh, the capability to style the background is a feature and function of the client JS library, BokehJS. There's currently no amount of monkey patching from the python side that have any effect on making something that is not possible in BokehJS be possible. We are working on making BokehJS extensible from python, however.
Upvotes: 1
Reputation: 3141
I'm using bokeh 1.0.2 and the following worked for me:
# Make legend fully transparent
plot.legend.background_fill_alpha = 0.0
Upvotes: 7