Created
April 16, 2017 21:22
-
-
Save steveharoz/5edcd68ac86e2989ef25e2e1346f8aff to your computer and use it in GitHub Desktop.
grouped bars example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
# make some data | |
df = expand.grid( | |
x = 1:5, | |
category = LETTERS[1:3] | |
) | |
df$value = runif(nrow(df), 0, 50) | |
# chart | |
ggplot(df) + | |
aes(x=x, y=value, fill=category) + | |
geom_col( | |
width=0.7, # shrink the bars | |
position=position_dodge(width=0.7) # position the bars | |
) |
Author
steveharoz
commented
Apr 16, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment