- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to change the title size of a graph using ggplot2 in R?
The size of a graph title mattes a lot for the visibility because it is the first thing people look at after plot area. Its size must not be very large nor very small but is should be different from the axis titles and axes labels so that there exists a clarity in the graph. This can be done by using theme function.
Example
Consider the below data frame −
set.seed(1) x <-rnorm(100) df <-data.frame(x) library(ggplot2)
Creating histogram of x and writing title of the graph −
ggplot(df,aes(x))+geom_histogram(binwidth=0.5)+ggtitle("Histogram")
Output
Changing the size of the title
ggplot(df,aes(x))+geom_histogram(binwidth=0.5)+ggtitle("Histogram")+theme(plot.title = element_text(size=20))
Output
- Related Articles
- How to change the text size of Y-axis title using ggplot2 in R?
- How change the color of facet title using ggplot2 in R?
- How to change the tick size using ggplot2 in R?
- How to change the Y-axis title to horizontal using ggplot2 in R?
- How to change the legend title in ggplot2 in R?
- How to change the title of a graph to italic created by using plot function in R?
- How to change the color of gridlines of a ggplot2 graph in R?
- How to change the plot border color of a ggplot2 graph in R?
- How to change the size of dots in dotplot created by using ggplot2 in R?
- How to display data frame name in ggplot2 graph title in R?\n
- How to change the font size of main title of boxplot in base R?
- How to change the orientation and font size of x-axis labels using ggplot2 in R?
- How to display fraction in a plot title using ggplot2 in R?
- How to change the bars color to grey shade of a bar graph created by using ggplot2 in R?
- How to make a plot title partially bold using ggplot2 in R?

Advertisements