Using @joran’s sample data,
ggplot(dat, aes(x=xx, fill=yy)) + geom_histogram(alpha=0.2, position="identity")
note that the default position of geom_histogram
is “stack.”
see “position adjustment” of this page:
More Related Contents:
- Plot two graphs in same plot in R
- Generate multiple graphics from within an R function
- Create stacked barplot where each stack is scaled to sum to 100%
- How can I make consistent-width plots in ggplot (with legends)?
- Change bar plot colour in geom_bar with ggplot2 in r
- Inserting an image to ggplot2
- How do you order the fill-colours within ggplot2 geom_bar
- ggplot2: facet_wrap strip color based on variable in data set
- Difference between passing options in aes() and outside of it in ggplot2
- How to draw stacked bars in ggplot2 that show percentages based on group?
- R – image of a pixel matrix?
- Eliminating NAs from a ggplot
- Setting y axis breaks in ggplot
- How to extract the fill colours from a ggplot object?
- R knitr Markdown: Output Plots within For Loop
- ggplot2 multiple scales/legends per aesthetic, revisited [duplicate]
- Generate paired stacked bar charts in ggplot (using position_dodge only on some variables)
- facet_wrap add geom_hline
- Improve centering county names ggplot & maps
- How to draw a nice arrow in ggplot2
- Bars in geom_bar have unwanted different widths when using facet_wrap
- beautiful Pie Charts with R
- Generate ggplot2 boxplot with different colours for multiple groups
- Layered axes in ggplot?
- Connect stack bar charts with multiple groups with lines or segments using ggplot 2
- How to specify columns in facet_grid OR how to change labels in facet_wrap
- How to get geom_vline to honor facet_wrap?
- R – ggplot line color (using geom_line) doesn’t change
- R ggplot ordering bars within groups
- ggplot for loop outputs all the same graph