Created
December 2, 2016 17:21
-
-
Save ibombonato/fa1539d3a5f434bdff4a3fc13a96e799 to your computer and use it in GitHub Desktop.
Plotting all variables from a data frame
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(ggplot2) | |
library(tidyverse) | |
df <- mtcars %>% | |
gather(-mpg, key="var", value = "value") | |
ggplot(df, aes(x = value, y = mpg)) + | |
geom_point(alpha = 0.3) + | |
geom_smooth(method = "lm") + | |
facet_wrap(~var, scales = "free") + | |
scale_color_gradient(low = "orange", high = "blue") + | |
theme_bw() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment