Plotly moveable/draggable legends, python - 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

Related

How to add custom data like "filename, email-id, created by" to plotly figure at the right end/top of the figure

I am trying to add custom data like "filename, email-id, created by" to python plotly figure at the right top/bottom of figure. see attached image for reference. I gone through API documentation and googled it. But didn't find any useful information.
Expectation:
As per the attached image.
What you are trying to do is annotate your figure. You should check out this link,this, this, and this!
One of the ways you can do this is through the fig.add_annotation() argument.
For instance, you can try to add the following code to add annotations to your figure and modify from there to see how it works.
fig.add_annotation(
dict(
font=dict(color='red',size=12),
x=0.9,
y=0.9,
text="I want to add annotation",
textangle=0,
xanchor='right'))
You can make all kinds of customisations through the fig.add_annotation.

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.

Is there a way to draw a radar chart with Altair in python?

I have been using the Altair python API for a Data Visualization project, and everything went smoothly until I wanted to add a radar chart to my app.
I could not find anything on Altair's python API documentation about radar charts, however there seems to be an entry about that in Altair's core documentation but I couldn't access it.
I saw that plotly had that feature but I would really have liked using only one plotting framework...
Is there really no way to make a radar chart with Altair in python ?
This is currently not implemented in VegaLite, you can see the discussion in these two issues and open a new one if you think there is a good case to be made for radar charts:
https://github.com/vega/vega-lite/issues/3805
https://github.com/vega/vega-lite/issues/408
In Altair you might be able to hack something together by layering multiple mark_arc charts with a fillOpacity=0 and a colored stroke (although I don't think this will work since I can't see any way to get right of the lines going towards the middle.

Image background in bar charts using bokeh (python)

I have a basic bar chart with the x-axis having categorical values of countries. I want to give each bar, an image background of the country's flag, to make the chart more appealing also to eliminate the x-axis labels. I am currently using bokeh for my charts and I dont think it is possible via this. Any ideas for the same, maybe some other python libraries which might do the trick?
Thanks

bokeh multiple figures with shared legend

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.

Categories

Resources