bokeh multiple figures with shared legend - python

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?

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.

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.

Related

Geopandas Scheme keyword stops legend modification

New to the site and Geopandas but any advise would be good attached a pic of code and plot. It seems when you use schemes="" it creates a legend which cant be altered. If you remove this you get the normal colorbar legend . If you look at my picture What I am after is a way to make it ncol=10 so the legend goes flat and move it below the plot. Also how do you adjust the font size of title from a legend created with the schemes keyword.

Legend sharing Plotly Dash Legendgroup

I am working with multiple plots in my dashboard, all have same time on x axis, same multiple traces (dates) and different values on yaxis.
I want to click on a chart legend and all other charts should do the same. I tried subplots, worked but colors are allways different and also some other issues. Any idea if this is possible without using subplots or a keyword that i have missed?
Thank you very much

Create a figure of figures with matplotlib

I would like to know if there is a way to combined several figures created with matplotlib in one unique figure.
Most of the existing topics are related to multiple plots within one figure. But here, I have several functions which all create one elaborated figure (not just a plot, the figure itself is a multiple plot with texts, title, legends,...)
So instead of just doing the layout of those several figures using a software like Word, is there a way to directly combined all my figures in one unique figure under python ?
Thank you in advance !
The concept of figure in matplotlib does not allow to have a figure inside a figure. The figure is the canvas for other artists, like axes. You may of course add as many axes to a figure as you like. So for example instead of one figure with 4 axes and another figure with 6 axes, you can create a figure with 10 axes.
A good choice may be to use the gridspec, as detailed on the respecive matplotlib page.
After additional researches, it seems my problem has no easy solution within Matplotlib itself. Multiple figures layout needs external post-processing of plots.
For those having the same problem, here is an interesting link :
Publication-quality figures with matplotlib and svgutils

Plotly moveable/draggable legends, python

Is it possible to make the plotly legends draggable? Currently I have my legend positioned outside the graph. I want to move it inside the graph, which is covered in the documentation, but I want to be able to make it draggable.
There is no direct way to drag the legend on a Plotly chart as far as I know.
You could find a workround by creating your legend in a HTML canvas and binding the onclick() function for each legend item to the Plotly PostMessage API restyle task.
There's a live example of the PostMessage API here which you should be able to hack apart. Let me know how you get on, this sounds interesting!
You can set "editable": True in the plot config.
https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L46-L54

How can I draw inline line labels in matplotlib?

I have the following graph, consisting of several lines:
Now, I would like to label all the lines in the plot. However, using legend() crams all the labels together in a box, which makes the plot somewhat difficult to interpret. What I'd like to to instead is to use inline labels. My ideal output would use labels like the following matplotlib contour plot, but with text labels for lines instead of numbers:
I haven't been able to find out how to do this in the matplotlib documentation. Is there a way to achieve this? If not, what other software could I use to generate this type of plot?
May I suggest another solution to your problem. Since in your case legend overlaps the charts you might just want to move the legend outside of the plot.
Method do move legend outside of plot is described here:
Moving matplotlib legend outside of the axis makes it cutoff by the figure box

Categories

Resources