How to Change Position of ggplot Title in R ? Last Updated : 16 Apr, 2025 Comments Improve Suggest changes Like Article Like Report In R, the ggplot2 package is widely used for creating data visualizations. One of the frequent customizations is rotating the title of a plot. The title for a ggplot2 plot defaults to left-alignment, but you might like to change its position according to the design or layout of the plot.Adding a Title to a Plot with ggtitle()The ggtitle() function in ggplot2 allows you to add a title to your plot.Syntax:ggtitle("title")By Default the title is left aligned. Thus, if the requirement is a left-aligned title nothing much has to be done.Example: Default Left-Aligned Title R library("ggplot2") x<-c(1,2,3,4,5) y<-c(10,30,20,40,35) df<-data.frame(x,y) ggplot(df,aes(x,y))+geom_line()+ ggtitle("Default title") Output:Changing the Title Position Using the theme() FunctionTo display the title at any other position of the plot use theme() function. Within theme() function use plot.title parameter with element_text() function as value to it. Again within this function pass the value for hjust attribute.Syntax: theme(plot.title=element_text(hjust=value))To get the title at the center the value of hjust should be assigned to 0.5.Example: : Center-Aligned Title R library("ggplot2") x<-c(1,2,3,4,5) y<-c(10,30,20,40,35) df<-data.frame(x,y) ggplot(df,aes(x,y))+geom_line()+ ggtitle("Title at center")+ theme(plot.title = element_text(hjust=0.5)) OutputTo display title at the right, hjust should be assigned 1 as value.Example: Right-Aligned Title R library("ggplot2") x<-c(1,2,3,4,5) y<-c(10,30,20,40,35) df<-data.frame(x,y) ggplot(df,aes(x,y))+geom_line()+ggtitle("Title at right")+ theme(plot.title = element_text(hjust=1)) Output: Comment More infoAdvertise with us Next Article How to Change Position of ggplot Title in R ? V vanshikagoyal43 Follow Improve Article Tags : R Language R-ggplot Similar Reads How to change legend title in ggplot2 in R? In this article, we will see how to change the legend title using ggplot2 in R Programming. We will use ScatterPlot. For the Data of Scatter Plot, we will pick some 20 random values for the X and Y axis both using rnorm() function which can generate random normal values, and here we have one more p 3 min read How to change legend title in R using ggplot ? A legend helps understand what the different plots on the same graph indicate. They basically provide labels or names for useful data depicted by graphs. In this article, we will discuss how legend names can be changed in R Programming Language. Let us first see what legend title appears by default. 2 min read Position ggplot text in Each Corner in R In this article, we will learn how to position ggplot2 text in each corner in the R Programming language. To perform this task we will be using geom_text() function from ggplot library. We will be also be using reserved keywords in R which is Inf and -Inf. These are reserved keywords in the R progr 2 min read How to change line width in ggplot2? ggplot2 is a data visualization package for the statistical programming language R. This article discusses how can we change line width in ggplot2. For this, only the size parameter in the geom_line() function has to be initialized to the required value. Syntax: geom_line(mapping=NULL, data=NULL, st 1 min read How to Adjust Title Position in Matplotlib? In this article, you learn how to modify the Title position in matplotlib in Python. Method 1: Using matplotlib.pyplot.title() function The title() method in matplotlib module is used to specify title of the visualization depicted and displays the title using various attributes. Syntax: matplotlib.p 3 min read How to Position Annotate Text in the Blank Area of Facet ggplot in R Facet plots in ggplot2 are a powerful way to display multiple plots based on different subsets of your data. However, annotating text within these plots can be challenging, especially when you want to place text in specific blank areas. This article will walk you through the process of positioning a 3 min read How to move or position a legend in ggplot2? In this article, we will discuss how to control a legend position in ggplot using an R programming language. To draw a legend within ggplot the parameter col is used, it basically adds colors to the plot and these colors are used to differentiate between different plots. To depict what each color re 3 min read How can I control the x position of boxplots in ggplot2? Boxplots are a powerful visualization tool in R, especially when using the ggplot2 package. They allow you to compare distributions across categories while also highlighting the presence of outliers. However, there are times when you might want to control the position of your boxplots along the x-ax 3 min read How to annotate a plot in ggplot2 in R ? In this article, we will discuss how to annotate functions in R Programming Language in ggplot2 and also read the use cases of annotate. What is annotate?An annotate function in R can help the readability of a plot. It allows adding text to a plot or highlighting a specific portion of the curve. Th 4 min read How to change Colors in ggplot2 Line Plot in R ? A line graph is a chart that is used to display information in the form of series of data points. It utilizes points and lines to represent change over time. Line graphs are drawn by plotting different points on their X coordinates and Y coordinates, then by joining them together through a line from 2 min read Like