-
-
Save riinuots/25817167cfd397cacecdf6f38b473392 to your computer and use it in GitHub Desktop.
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) | |
#example dataset: | |
mydata = data.frame(x = 1:10, y=1:10 | |
, cat = c(rep('first', 3), rep('second', 3), rep('third', 4))) | |
#create (a), (b), ... | |
my_plotlabels = paste0('(', letters, ') ') | |
#paste plot labels together with the levels of the variable used for faceting | |
levels(mydata$cat) = paste0(my_plotlabels[1:length(levels(mydata$cat))] | |
, levels(mydata$cat)) | |
ggplot(mydata, aes(x=x, y=y))+ | |
facet_wrap(~cat)+ | |
geom_point(size=2, shape=7)+ | |
theme_bw() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment