Bokeh: Barchart with relative Barmode - python

I am trying to implement a barchart with “relative Barmode” in Bokeh. In particular, I would like to achieve a barchart with two groups (a, b). If a is positive it should be on top of b, however, if a is negative it should be under the x-axis and below b. A chart which visualizes my wish using plotly is here:
https://plot.ly/python/bar-charts/#bar-chart-with-relative-barmode
Does anyone of you know how I can implement such visualization using bokeh barchart?
Thanks
Andy

Related

A 2D bar chart in a 3D chart using Plotly

I am trying to plot 2D bars in a Plotly 3D figure. I understand that Plotly's 3D figures do not yet support bar charts out of the box, but I have come across some examples from other people on the Plotly forums which have shown how this might be achieved.
Please see the post Adding a shape to a 3D plot. This is close to what I am trying to achieve, but I am not trying to plot a histogram.
It appears plotting traces as a mesh3d, adding in the missing points and triangulating is the way to go for Plotly's 3D chart, according to other examples I have seen. Below is an example of what I am looking for that I created using Matplotlib.
As you can see, x axis is the date, y axis is the trace name and z axis is the value. I would like to see if I can achieve something similar using Plotly's 3D charts, which are so much better of course because of the client side interactivity.
Is there a working example for what I'm trying to achieve? I am simply looking to plot simple (date, value) per trace as 2D bars in the 3D figure.
There isn't any current way to have a bar chart in 3D with Plotly (at least that I am aware of).
Documentation: Plotly Python Open Source Graphing Library 3D Charts
As shown in the documentation, there aren’t any options for a bar chart. There are, however, alternatives like a bubble chart.

Plotting a grouped stacked bar chart

I am trying to create a grouped, stacked bar chart. I was able to do it in excel and this image shows what I am trying to create but I want to do it through Python. I have all the data in a pandas data frame that is able to create separate stacked bar charts but I cannot get the grouping as seen in excel.
Excel Formatting:
If you could do it in Excel with easy then I strongly suggest you to do it with Excel. Unless you have other requirements.
There are many libraries you can use to create this type of plot: matplotlib, seaborn, or plotly. The one I use most is plotly. You can see the list of sample figures of plotly here: https://plotly.com/python/
Or you can join plotly community, there are many pros there might help with figure. I find there is few pros on figures in stackoverflow to plotly community: https://community.plotly.com/

Bokeh line chart is plotting weird

I am trying to plot chart in my data science project. And I want to plot chart in this way
which is produced by Matplotlib library. And now I want to plot in the same way. But it gives me this way in bokeh.
My data for this in the form of python list and it is as below:
ages = [45.0,50.0,55.0,40.0,60.0,35.0,65.0,30.0,70.0,25.0,75.0,20.0,80.0,85.0,15.0,90.0,10.0,0.0]
ageCounter = [4466,4270,3824,3576,3240,2850,2527,2358,1968,1544,981,655,419,149,132,80,17,2]
Is there any thing I am missing.
Thanks in advance.
You need to sort the arrays together by age. Bokeh plots the points in the order you pass them in. The data above is out of order which explains the "zigzag".

Gantt chart using plotly

I am using plotly in Python 2.7 to produce Gantt charts like -
But instead of filling the individual bars with color, I wish to fill them with different patterns so that it can be read even when printed in grey scale.
Is there a way to do that in Plotly? If not what other Python packages can do it?
Thanks!

Two violin plots (horizontal and vertical) intersecting at a point

I am unsure whether this functionality is possible through Plotly or if it is achievable with other plotting packages so I am open to different solutions.
I am trying to plot two violin plots in a single figure where one violin is oriented horizontally while the other is vertical. I would like to specify the point at which they intersect (i.e the primary axis of each). Ideally each would be transparent and interactive.
Somewhat poor illustration of what I need
Thank you for any proposed solutions!
There are multiple Python libraries doing Violin Plots. Plotly is among them, check its manual.
Besides, Seaborn is really good at this:
It is a Python visualization library based on Matplotlib. The code snipped for the above example can be found in Seaborn's gallery.

Categories