Change the font size of a ggplot chart

ggplot2, r

Solution

Size of texts are changed using function `theme()` and then choosing element you need to modify. To set font size for all texts in plots attribute `text` should be changed.

ggplot(mtcars,aes(cyl,mpg))+geom_point()+theme(text=element_text(size=21))

Problem

In a ggplot chart I have a title for chart and values for x and y axis. When I save the chart as an image the labels are tiny. I tried to change the font size using: ``` size = 21 ``` But it didn't work. Is there any easy way to chage the font size for the whole chart?

Original source