Questions tagged [stacked-bar-chart]

A stacked bar chart is a graphical representation of data where, for each categorical group, there are two or more bars colored to represent a particular grouping. The value is represented by the length of the bar segment.

247 questions
1
vote
2 answers

Stacked barplot with two categories in R

I am trying to create a stacked barplot in R to visualize differences in two groups. My dataset looks like this: A User ABC Male DEF Female GHI Female XYZ Female JKL Male ABC Male XYZ Male XYZ Female I would like the User…
user2845095
  • 465
  • 2
  • 9
1
vote
1 answer

Stacked bar plot for items with multiple identifiers across dates using plotly

I have the following data frame sensor_id u_code date_time 1234abcd 4 13-06-2022 18:02 5678efgh 4 13-06-2022 18:02 1234abcd 2 13-06-2022 18:03 5678efgh 2 13-06-2022 18:03 1234abcd 6 13-06-2022 18:04 5678efgh 6 13-06-2022…
aj7amigo
  • 368
  • 2
  • 12
1
vote
2 answers

Displaying a stacked bar graph from a few lists in python

I have a few lists as below- Clusters=['Cluster1', 'Cluster2', 'Cluster3', 'Cluster4', 'Cluster5', 'Cluster6', 'Cluster7'] clusterpoints= [[0, 2, 0, 5, 1, 0, 0, 0, 6, 0], [0, 0, 5, 0, 0, 5, 1, 0, 1, 0], [3, 0, 0, 1, 0, 6, 2, 0, 0, 0], [1, 4, 0, 1,…
1
vote
1 answer

how to plot 100% bar chart from a stacked chart

Hi I am trying to use plotly to create a 100% stacked bar chart in streamlit using plotly. I tried using relative but to no avail. dfCategory =…
Hal
  • 193
  • 1
  • 9
1
vote
0 answers

Stacked bar chart does not follow order with negative and positive values

Suppose we have a simple data that has automatically ordered from largest to smallest in excel: Series value a 5 c 3 d 2 b -1 e -1.5 When you insert a stacked bar chart, switch rows and columns to make it stacked, the outcome is…
Peter
  • 31
  • 3
1
vote
1 answer

Stacked bars for a population pyramid

I want to create a population pyramid with stacked bars to show distribution of M and F according to age groups and directly show how many nationals and how many foreigners are in each age groups. So a bar to the left shows males and the values for…
RemoZT
  • 11
  • 1
1
vote
1 answer

How to plot Stacked Bar Chart with Text Overlay with Plotly in Python?

I'm trying to plot a Stacked Bar Chart with Text Overlay with Plotly in Python. Like the below one Sample…
Ailurophile
  • 2,552
  • 7
  • 21
  • 46
1
vote
1 answer

plotly bar chart no data is shown

I am using go.Bar() to plot multiple series bar chart, I am not sure why no data is shown. the chart is empty. For same dataframe, I can get 2nd figure when using matplotlib. here are the codes/dataframe and the plots. Thanks for your help import…
roudan
  • 3,082
  • 5
  • 31
  • 72
1
vote
1 answer

Custom Legend multiple colors in Google Chart

I am facing a problem that I cannot custom the default legend color of this chart to multiple colors, please help me. This is image describe my problem , I am using stacked bar chart. This is my code: //dump data arr var data =…
1
vote
1 answer

How to make a horizontal stacked bar plot of values as percentage

I have a list of 0,1 in dataframe. How can I plot a percentage of bar plot in pandas or matplotlib, that would have in the legend 1,0 and written annotation of percentage of the 1,0 compare to the whole list? import pandas as pd import…
1
vote
1 answer

How to create grouped and stacked bars

I have a very huge dataset with a lot of subsidiaries serving three customer groups in various countries, something like this (in reality there are much more subsidiaries and dates): import pandas as pd import matplotlib.pyplot as plt df =…
1
vote
2 answers

How to create a stacked bar plot with column names on the axis from a wide dataframe

The first image is the figure I'm trying to reproduce, and the second image is the data I have. Does anyone have a clean way to do this with pandas or matplotlib?
khajiit
  • 85
  • 5
1
vote
1 answer

Give custom color to each component of stacked bar plot

I would like to give custom color to each component of the stacked bar plot. import numpy as np import matplotlib.pyplot as plt labels = ['Cars', 'Electric/\nHybrid/\nFuel', 'Diesel/\nOctane/\nPremium'] row1 = [2000,1800,1200] row2 =…
SaadH
  • 1,158
  • 2
  • 23
  • 38
1
vote
2 answers

How to create a stacked bar for each group

I have the following dataset: SessionId Query 1 a 1 b 2 a 3 b 3 b 3 c 3 a I want to display a stacked bar chart where there will be a bar for each…
Lee
  • 781
  • 2
  • 11
  • 31
0
votes
2 answers

How do I change the order of x axis variables and add another layer of x axis labelling for before and after (in R)?

I have gone through and followed this guide on how to make stacked bar plots with percentages: Plot stacked bar chart of likert variables in R Issue 1: it has organised the bars alphabetically, not in the order I had them. Issue 2: I have Before and…
lisa
  • 5
  • 2