When following the bokeh docs for making gridplots, if I use figure
's legend
keyword argument I get a legend inside each subplot. How could I get a shared legend for the entire gridplot? Further, how could I get a shared legend between say 3 out of 4 of the subplots?
Asked
Active
Viewed 3,236 times
7

user2561747
- 1,333
- 2
- 16
- 39
-
1In http://stackoverflow.com/questions/26254619/position-of-the-legend-in-a-bokeh-plot is an example to answers your question. – elsa Sep 07 '16 at 15:35
-
1@elsa I don't think that's what the OP meant... I'm in the same boat, I have 4 figures that I plot together using 1 layout and would like to share the Legend across them (they use the same labels and colors). – aiguofer May 15 '17 at 21:36
-
1My solution for this is usually to add the legend to a single subplot, wherever it makes more sense in each scenario, then that legend works as the "shared" legend. I didn't know about using negative numbers with the "location" attribute, as mentioned in @elsa's link; that might work even better. – Rafael Martins Feb 23 '18 at 10:23
2 Answers
3
As of Bokeh 0.13.0
, it is not possible to share legends between plots, nor to have legends contain renderers from outside the plot they are defined on. There is an open issue on GitHub you can follow for updates.

bigreddot
- 33,642
- 5
- 69
- 122
1
Since there is no official support.
Here is an advice that barely qualifies as an answer -
You can plot one extra empty figure in your grid with legends ON
which can act as a reference for your plots where legend is OFF.

markroxor
- 5,928
- 2
- 34
- 43
-
Can you provide some code to show how to use the empty plot legend in the other plots? Do you need to write a Javascript callback? – John Robinson Jun 20 '19 at 15:07