How to make stacked bar chart in Python? - python

I have multiple categorical data (tool_id) in my data set and each has total count tested per day. I would like to make a stacked barplot where total count per tool_id that are stacked in a day for the whole month.
What python libraries can be used to easily plot a stacked bar chart and how to code it? I have tried seaborn but looks like it does not have stacked bar chart capability, correct me if I'm wrong.

Related

Plotly Stacked Bar Chart: Different Coloring of Bars

I have created a stacked bar chart with Plotly for my Dash App, but I want to assign a different "color-scale" to each bar. There's 14 bars in total with subgroups of up till 14. The bar is depending on a range slider (years); it can show data from multiple years or one year only. When I choose one year, the code works fine and the bars are colored differently, but when more years are selected, it doesn't work as all bars gets the same color as defined for the first bar only.
I want something like this (three bars shown only): https://i.stack.imgur.com/G4g8X.png
But gets something like this when a time span is selected:
https://i.stack.imgur.com/376BS.png
Do anyone know how to fix it? :)

Stacked bar chart in matplotlib without hardcoding the fields

I am trying to create a simple stacked bar chart using this data using ONLY matplotlib, pandas and numpy:
x-axis: Month
Labels: activity type
Height: distance
The examples I see, loop over the x-axis, but labels are always hard coded.
Can we loop over everything? In other words, can I create a chart without modifying this table:
No group by or pivot, just use the table as is and get the chart using matplotlib, pandas and numpy only (learning those at the moment)

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/

Footprint Style Stacked Bar Chart Using Matplotlib

I want to create a chart like the one given below. how can I achieve something like that in matplotlib.
.

Plotly Histogram to contain individual data values

Is there a way to plot a plotly histogram such that each bin contains further details of individual data values?
An example is the google chart histogram:
https://developers.google.com/chart/interactive/docs/gallery/histogram

Categories