- 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 display superscript for X-axis title in base R plot?
To display superscript for X-axis title in base R plot, we can use ^ sign inside mtext function before defining the plain text.
For example, if we want to display X2 at position 5 on X-axis then it can be done by using the below command −
mtext(expression(paste(plain("X")^plain("2"))),side=1,line=2,at=5,cex=1.2)
Example
Consider the following snippet −
plot(1:10)
Output
If you execute the above given snippet, it generates the following Output −
To display superscript for X-axis title in base R plot, add the following code to the above snippet −
Example
plot(1:10,xlab="")
Output
If you execute all the above given snippets as a single program, it generates the following Output −
To display superscript for X-axis title in base R plot, add the following code to the above snippet −
Example
mtext(expression(paste(plain("Displaying Superscript")^plain("2"))),side=1,line=2,at=5,cex=1.2)
Output
If you execute all the above given snippets as a single program, it generates the following Output −
- Related Articles
- How to display the superscript for a single variable in a base R plot?
- How to display X-axis labels inside the plot in base R?
- How to display X-axis labels with dash in base R plot?
- How to change the Y-axis title in base R plot?
- How to display raise to the power on X-axis in base R plot?
- How to display x-bar in base R plot?
- How to change the position of X-axis in base R plot?
- How to display fraction in base R plot?
- How to create a plot in base R with dates sequence on X-axis?
- How to display infinity symbol in base R plot?
- How to change the axis color in base R plot?
- How to fix the lower value for X-axis in base R
- How to display fraction in a plot title using ggplot2 in R?
- How to create a plot with tick marks between X-axis labels in base R?
- How to create bar plot in base R with different limits for Y-axis?

Advertisements