Add a databox to a plotly subplot - python

I am trying to build a tearsheet where there will be charts on the left and data on the right. This is being exported from within a python financial application.
The plots are no problem but I cannot find online how to add the text box on the right side of the sub-plot.
Is there a way to add data in a chart box such as in the example linked above?

Related

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.

How can I add a square with a text next to a chart (in Python/Plotly)

I prepared a page with charts, using graph object library. I'm trying to add a short information about the each chart on this screen, e.g. "Service Level", next to a chart (on left side).
screen
I would be grateful for any help :)

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

python plotly: how to make a choropleth map with a slider (access grid data issue)

I want to draw a choropleth world map with a slider for the year values. It would be a combination of the "Choropleth Map" and the "Adding Sliders to Animations" (https://plot.ly/python/).
First I searched plotly's community forum and the web for an example of a plotly choropleth map with grid data or a slider without success.
While I managed to replicate the slider animation example with my data (see jupyter notebook link below), adapting the choropleth code to access grid data with a slider does not seem to work.
In contrast to a regular map (like in example one), data is not loaded from a dataframe column but is uploaded to a plotly grid. In example two we can see that instead of regular x,y and text values in the data_dict, xsrc, ysrc and textsrc are used to access the grid data.
data_dict = {
'xsrc': grid.get_column_reference(col_name_template.format(
year=year, continent=continent, header='lifeExp'
)),
'ysrc': grid.get_column_reference(col_name_template.format(
year=year, continent=continent, header='gdpPercap'
)),
Chloropleth maps are defined in plotly by setting locations, z-values and text values in list form. In order to check if plotly choropleth maps support grid data, I searched in the api-documentation and found equivalents: locationsrc, zsrc, and textsrc. Therefore using grid data should be possible. When I draw my adapted graph though, I see only the coastline and the slider but no countries being highlighted.
A jupyter notebook with code and data with additional links can be found here: https://github.com/MathiasRiechert/plolty-choropleth-slider-notebook/blob/master/choropleth-slider-notebook.ipynb
Unfortunately, I can't find a way to debug why nothing is shown in the map. Is there a way to debug why nothing is shown on the plotly website?
What else reasons might cause that nothing is shown?

How to draw a graph that can indicate the values when the mouse moves to some part of the graph in python and put it on the web page?

I'm writing a web interface for a database of genes values of some experiments with CGI in Python and I want to draw a graph for the data queried. I'm using matplotlib.pyplot, draw a graph, save it, and perform it on the web page. But usually there are many experiments queried hence there are a lot of values. Sometimes I want to know which experiment does one value belong to because it's a big value, whereas it's hard to identify because the picture is small in size. The names of the experiments are long strings so that it will mess the x axis if I put all the experiment names on the x axis.
So I wonder if there is a way to draw a graph that can interact with users, i.e. if I point my mouse to some part on the graph, there would be one small window appears and tells me the exact value and what is the experiment name here. And the most important is, I can use this function when I put the graph on the web page.
Thank you.
What you want is basically D3.js rendering of your plots. As far as I know, there are currently three great ways of achieving this, all under rapid development:
MPLD3 for creating graphs with Matplotlib and serving them as interactive web graphics (see examples in Jake's blog post).
Plotly where you can either generate the plots directly via Plotly or from Matplotlib figures (e.g. using matplotlylib) and have them served by Plotly.
Bokeh if you do not mind moving away from Matplotlib.

Categories

Resources