I'm trying to create a bar chart in MATLAB where bar positions are in one column, bar heights are in another, and the bars are stacked whenever two or more positions overlap.
To illustrate, here is the same chart created in R with ggplot:
library(ggplot2)
data <- data.frame(name=c('A', 'B', 'C', 'D', 'E', 'F'),
pos=c(0.1, 0.2, 0.2, 0.7, 0.7, 0.9),
height=c(2, 4, 1, 3, 2, 1))
ggplot(data, aes(x=pos, y=height, fill=name)) +
geom_bar(stat='identity', width=0.05)
For comparison, in MATLAB, the same data looks like:
data = [ 0.1, 0.2, 0.2, 0.7, 0.7, 0.9; ...
2, 4, 1, 3, 2, 1]';
But I can't figure out whether there's a combination of parameters to the bar
function to create the same sort of stacked bar chart.