Created
April 17, 2019 06:01
-
-
Save yutannihilation/0b3a2b30ece153902c068fba5bf738f2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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(ggplot2) | |
p <- ggplot(mtcars, aes(factor(cyl))) + | |
geom_bar(aes(fill = factor(cyl))) | |
p + scale_x_discrete(limits = c("4", "8")) | |
p + scale_fill_discrete(limits = c("4", "8")) | |
cols <- c("8" = "red", "4" = "blue", "6" = "darkgreen", "10" = "orange") | |
p + scale_fill_manual(values = cols, limits = c("4", "8")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment