Questions tagged [stacked-chart]

For questions about stacked charts, i.e. charts where multiple data series are superimposed.

Stacked are charts in which you collect multiple data series and display their cumulative values. These can be stacked histograms, stacked areas, or a number of other arrangements.

Stacked areas Stacked areas adding up to 100% 3d example Stacked area chart

Typical questions involve how to get this sort of layout from various plotting engines and how to affect details like legends, orientation, color palette, grouping, etc.

674 questions
2
votes
1 answer

How to create stack bar charts that look cubic (3D) in R ggplot2?

I want the stack charts as coded below but I want them to look cubic (attached). Is it even possible in R? set.seed(123) specie <- c(rep("sorgho" , 3) , rep("poacee" , 3) , rep("banana" , 3) , rep("triticum" , 3)) condition <- rep(c("normal" ,…
Rspacer
  • 2,369
  • 1
  • 14
  • 40
2
votes
1 answer

Google charts javascript : Stacked column, transparent color

Here is the stacked chart I have, I would like to be able to change the color of the session (here red) in transparent. Would you have an idea ? thanks. And here is my code : var data = google.visualization.arrayToDataTable(my_data); var options =…
Alex
  • 217
  • 1
  • 17
2
votes
3 answers

Can I reorder the stacking in a geom_col to match the order in my data?

I am trying to draw soil profiles with ggplot. However, geom_col groups first all sand layers together, then all peat layers and finally all clay layers. I would like the order to depend on the order in my dataframe or, alternatively, on the order…
RHA
  • 3,677
  • 4
  • 25
  • 48
2
votes
0 answers

Altair barchart showing percentage

I would like to plot a stacked barchart using altair. The data is a time series. The expected output is to count the IDs per date (and per group, which is "type") and to calculate its percentage of the total of the group.This is given in the columns…
Aham
  • 113
  • 6
2
votes
1 answer

How to prepare data for d3 stacked barchart using rollup

I am new to JavaScript and D3.js and atm trying to create an Angular App with a stacked bar chart visualisation of the number of different test results 'OK', 'NOK' and 'Aborted' of each day as a stacked bar in the y-axis and the dates as the…
j_tum
  • 59
  • 7
2
votes
2 answers

How to create a percentage stack plot for unequal group size in R?

I have 2 groups namely "A" and "B" of unequal sample size. The size of "A" is 19 and the size of "B" is 15 total size of data being 34. They have a categorical variable named "Drug1" to indicate how many people of group A and B takes that drug so…
Jan_vi
  • 23
  • 3
2
votes
2 answers

Plot stacked bar chart of likert variables in R

lets say I have a data frame that looks like this: P Q1 Q2 ... 1 1 4 1 2 2 3 4 3 1 1 4 where the columns tell me which person answered which of the questions q1, q2, ... accordingly. Those questions require an answer…
manuel459
  • 173
  • 1
  • 10
2
votes
0 answers

Plotly: Display total sum of number on top of stacked bar chart

Let's use the example in the following URL:https://jsfiddle.net/d3fzsw25/ I would like to display the total sum on top of the stacked bar chart. The value should display 45. I tried to use the "Text" and "Annotation" method to display my total…
Marzack
  • 47
  • 8
2
votes
1 answer

Ordering the 'fill' of a stacked bar chart ggplot2

Is there a way for me to order my stacked barchart by the variable The_Number_Of_Evaders rather than having to manually input the levels I would like? The_Number_Of_Evaders <- c(287, 76, 237, 44, 249, 149, 3) The_Results_Of_Using_The_Line <-…
NickRuss98
  • 47
  • 4
2
votes
1 answer

R plotly show only labels in the stacked bar chart where percentage value for the stack is above 5

I'm having a dataframe df <- data.frame("QuarterYear" = c("2019 Q1","2019 Q1","2019 Q2","2019 Q2","2019 Q3","2019 Q3","2019 Q3"), "Size" = c("Medium","Small","Large","Medium","Large","Medium","Small"), "percentage" =…
Nevedha Ayyanar
  • 845
  • 9
  • 27
2
votes
1 answer

How do I create a frequency stacked bar chart however have percentage labels on the bars and frequencies on the y axis, in R?

I started with the code below, however it is not showing the right output. I would just like a normal frequency stacked bar chart to show percentages on the bars but frequencies on the y axis. Could anyone offer any suggestions please? ggplot(data =…
Jed
  • 331
  • 2
  • 11
2
votes
1 answer

google charts bar horizontal move annotation position to center of stacked chart

I am using Google Chart's column graph chart. The chart is a stacked column chart with annotations for every data point of the stacked column. The annotation are at the right of the inside of the bar but I would like them to be centered inside of…
2
votes
1 answer

How to sort stacks within each ggplot's facets?

Please help us sort the stacks in ascending order ! i.e. left facet seems to be in order but right side is not really sorted because 1.7 should have come at the right end. (please refer screenshot) similar but not exact queries How to control…
Abhishek
  • 407
  • 3
  • 18
2
votes
0 answers

Problem with running the code for the circular barplot

I try to run the code for a circular barplot provided by https://www.r-graph-gallery.com/299-circular-stacked-barplot.html # library library(tidyverse) library(viridis) # Create dataset data <- data.frame( individual=paste( "Mister ", seq(1,60),…
Gary Hsu
  • 113
  • 8
2
votes
1 answer

Plotly: How to customize colors in a stacked bar chart?

I would like to ask you if you could help me in customizing of colors in a stacked bar chart created by plotly. The problem is following - I have to recreate a dashboard (from an excel file to a html file). A part of the dashboard is a chart…
haraslub
  • 151
  • 1
  • 10