46

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"))
nrussell
  • 18,382
  • 4
  • 47
  • 60
ameya
  • 533
  • 1
  • 5
  • 6

1 Answers1

100

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.

Community
  • 1
  • 1
Paul Rougieux
  • 10,289
  • 4
  • 68
  • 110
  • 5
    stating the obvious here, but took me 10 minutes to figure it out, if you're using a ``theme`` that sets a ``plot.title`` size, make sure to insert the ``theme(plot.title = element_text(size = 40, face = "bold"))`` line __after__ your call to ``theme_blabla()``, otherwise your theme's plot title size will override it. – PatrickT Jul 02 '17 at 18:06
  • 1
    Also you must set `plot.title` **not** `title`. – jsta Nov 14 '18 at 13:57