Boxplot with hover tool tip in Python - python

I am trying to achieve a Boxplot with hover tool tip in Python
I have tried bokeh.charts and bkcharts which are deprecated and no module is found for the same.
I even tried mpld3, but all I got was Scatter plot with the tooltip,
I even tried the bokeh box plot https://docs.bokeh.org/en/latest/docs/gallery/boxplot.html from here but it is very complex and making use of unnecessary groupby column.
If anyone has boxplot with hover tool tip in python than please help.
Similar functionality can be achieved very easily in R so why not in Python???

did you try plotly?
This example may help.
You may have to add JS code so I'm aware this may not be what you need. Switch to tab "Python & R" and look at the Python code. There are comments there.

Related

Customizing hvplot box

I am trying to get deep into hvplot to see if I can find a good alternative to plotly, but I am baffled by the documentation.
I am trying to plot boxplots with jittered points, and a basic tutorial can be found here.
The part of the example I am trying to customize is this:
import hvplot.pandas
from bokeh.sampledata.sprint import sprint as df
boxplot = df.hvplot.box(y='Time', by='Medal', height=400, width=400, legend=False)
boxplot
However, I want to style my plot, for example by removing the borders of each box, changing opacity, box width, and so on.
I tried to search that in the hvplot page, but the documentation seem to be limited to some basic examples and not much more.
On stackoverflow I managed to find some pointers to how to style plots but I tried and failed to find out how to do the above mentioned things.
Is there a more detailed documentation somewhere or do I just need to get deeper into holoviews?
Update:
I found in the customization guide of HvPlot that one can call hvplot.help('box'). That contains all the possibile options. The fact that box_color doesn't work still eludes me (box_fill_color works) but at least that's a more detailed explanation of how it works.
Leaving it here just in case someone else needs it.

Using plotly in python, how to make heatmap with annotations AND legend at same time?

In Python, using the latest version of plotly, how to make a heatmap that has both annotations and a legend?
The plotly library updated a few weeks ago and I can't find an working example for it anymore. The heatmap code seems fragmented where FigureFactory sub-library can make heatmaps with annotations easily, but the graph_objects sub-library can make heatmaps with legends. Nothing seems to do both at the same time and the documentation does not show a solution either.
Please help. Thank you.
I have tried the examples on both the following pages:
https://plot.ly/python/annotated_heatmap/
https://plot.ly/python/heatmaps/

Adding errorbars in ggplot Python

Can't find a way of adding errorbars to a Python ggplot plot. The following issue has been neglected for over a year. Nothing in the docs.
I had this same problem and found no solution. However I did find a way around it. You can use matplotlib in the style of ggplot. From there it's much easier to use error bars. I've attached an example of some code I used.
plt.style.use('ggplot')
This is an extract of one of my codes
df2.gLongCrFiltered['mean'].plot(kind='bar', yerr=df2.gLongCrFiltered['std'])
which returned this

How do I get the modern style matplotlib plots often seen in iPython Notebook examples?

Take this page, for example, a sample of which is posted below:
It has matplotlib examples with gray background and more subtle coloring, but when I'm running the same examples, I get the more traditionally colored plots with white background and strong colors. This also seems to be the style used in the pandas documentation.
How can I change the default style locally to match their style?
If you read through the page you linked, just above the Plotting in Pandas section is the following line:
If you want to make your plots look pretty like mine, steal the matplotlibrc file from Huy Nguyen.
In the post is a link to this gist, which contains the matplotlibrc file. Make sure you read through the whole thing and customize it, as for example he has MacOSX as his backend, which you may want to change.
To use the file, save it as ~/.matplotlib/matplotlibrc and restart any running instances of IPython. Your plots should now look prettier :)
As MattDMo mentioned, using a sane matplotlibrc really helps.
The book "Probabilistic-Programming-and-Bayesian-Methods-for-Hackers" also uses a nice matplotlibrc. See this for some examples.
Recently I'm using the package seaborn instead of a custom matplotlibrc not only because it makes my plots look great, but also because it adds some functionality for visualizing distributions, linear models and time series.

Compoud charts with python

I want to generate compound charts (e.g: Bar+line) from my database using python.
How can i do this ?
Thanks in Advance
You might want to look up Matplotlib.
This is extremely simple to do using matplotlib using the plot and bar methods:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.bar
The matplotlib gallery is usually a good place to start for examples of working code:
http://matplotlib.sourceforge.net/gallery.html
Pretty easy to do with pygooglechart -
You can basically follow the bar chart examples that ship with the software and then use the add_data_line method to make the lines on top of the bar chart
If you are rendering to a web browser, you might also consider jQuery and Flot using python-flot-utils. If you want static images, the other two answers are correct. Matplotlib is excellent.

Categories