Created
April 16, 2017 17:37
-
-
Save trinker/b2e65b839cd51019f7db2c3442549191 to your computer and use it in GitHub Desktop.
3d-like density plots
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(dplyr) | |
| library(tidyr) | |
| library(ggplot2) | |
| library(gridExtra) | |
| df = as.data.frame(setNames(lapply(jitter(sample(-2:2, 8, T)), function(x) rnorm(100, x)), c(LETTERS[1:8]))) %>% | |
| gather("var", "value", A:H) | |
| ggplot(df, aes(x=value)) + | |
| geom_density(fill="black", col="white", lwd=1) + | |
| facet_grid(var~., switch="y") + | |
| theme(strip.text.x=element_blank(), panel.background=element_blank(), | |
| panel.spacing.y=unit(-1, "cm"), panel.grid=element_blank(), | |
| axis.ticks.y=element_blank(), axis.text.y=element_blank()) |
trinker
commented
Apr 16, 2017
Author

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment