
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Change 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
Advertisements