Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the font size of ggtitle in ggplot2

Tags:

r

ggplot2

I would like to increase the font size of ggtitle and also the font should be bold. My code is as follows.

ggplot(df, aes(x1, y = value, colour = variable)) +    geom_point(size=2) +    ggtitle("male vs.female") +   theme(axis.text=element_text(size=14),         axis.title=element_text(size=14,face="bold")) +    theme(legend.text=element_text(size=12)) +    labs(x = "x axis", y = "y axis") +    ylim(0,100) + xlim(0,100) +    scale_colour_manual(values = c("red", "blue"),                        labels = c("male", "female")) 
like image 805
ameya Avatar asked Feb 17 '16 13:02

ameya


1 Answers

Use theme(), here is an example :

ggplot(cars, aes(x=speed,y=dist)) +      ggtitle("cars") + geom_point() +      theme(plot.title = element_text(size = 40, face = "bold")) 

enter image description here

Inspired by this answer.

like image 82
3 revs, 2 users 96% Avatar answered Oct 08 '22 16:10

3 revs, 2 users 96%