Last active
August 29, 2015 14:15
-
-
Save jeffreyiacono/804f6feda2707c4234fe to your computer and use it in GitHub Desktop.
R plots with manual color scale
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
d <- rnorm(1000) | |
df <- data.frame(x = seq(1, length(d), by = 1), y = d) | |
df$zscore <- (df$y - mean(df$y, na.rm = TRUE)) / sd(df$y, na.rm = TRUE) | |
ggplot(df, aes(x = x, y = y, group = abs(zscore) >= 1.95)) + geom_point(aes(color = abs(zscore) >= 1.95)) | |
ggplot(df, aes(x = x, y = y, group = abs(zscore) >= 1.95)) + geom_point(aes(color = abs(zscore) >= 1.95)) + scale_color_manual(values = c("FALSE" = "grey", "TRUE" = "red")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment