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)
I'd like to change the font size of the titles from facet_wrap
('bad' 'good')
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" )
Any ideas? Thanks!
We can change size of facet labels, using strip. text it should passed with value to produce labels of desired size.
In the Customizer choose Fonts, then under Headings change the font, style, and size. You will see the changes instantly. Click 'Save & Publish' to save your changes.
Under 'General Settings' you'll find 'Fonts & Typography'. You should be able to set the font and size for titles there. The default font size for the site title is 32px . You can change that to a lower size, such as 24px .
Set strip.text
in the 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))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With