Created
October 7, 2013 02:12
-
-
Save joannecheng/6861610 to your computer and use it in GitHub Desktop.
Conditional Colors in R (from Visualize This)
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
# This is unnecessary: | |
# fillColors <- c() | |
# for (i in 1:length(hotdogs$Country)) { | |
# if (hotdogs$Country[i] == "United States") { | |
# fillColors <- c(fillColors, "#821010") | |
# } else { | |
# fillColors <- c(fillColors, "#aaaaaa") | |
# } | |
# } | |
barplot(hotdogs$Dogs.eaten, border=NA, names.arg=hotdogs$Year, xlab="Year", ylab="Number Eaten", | |
col=ifelse(hotdogs$Country=="United States", "#821010", "#aaaaaa")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment