set.seed(1)
df <- data.frame(A=rep(c("good","bad"),each=8),
B=rep(c("yes","no"),4),
C=sample(1:20,16),
stringsAsFactors=F) %>%
group_by(A,B)
我想改变标题的字体大小facet_wrap
('坏''好')
ggplot(df, aes(x=B, y=C)) +
geom_violin() +
geom_point() +
facet_wrap(~A, nrow=1) +
theme_classic() +
theme( axis.text = element_text( size = 14 ),
axis.text.x = element_text( size = 20 ),
axis.title = element_text( size = 16, face = "bold" ),
legend.position="none" )
有什么想法吗?谢谢!
答案 0 :(得分:7)
在strip.text
:
theme
ggplot(df, aes(x=B, y=C)) +
geom_violin() +
geom_point() +
facet_wrap(~A, nrow=1) +
theme_classic() +
theme( axis.text = element_text( size = 14 ),
axis.text.x = element_text( size = 20 ),
axis.title = element_text( size = 16, face = "bold" ),
legend.position="none",
# The new stuff
strip.text = element_text(size = 20))