- 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 position of X-axis in base R plot?
By default, the position of X-axis is at the bottom and we know that it is always there in all software/programming tools. If we want to change the position of X-axis in base R plot then we can use axis function with pos argument. The pos argument will decide the position of the X-axis on Y-axis.
Check out the Example mentioned below to understand how it can be done.
Example
To change the position of X-axis in base R plot, use the following command −
plot(1:10)
Output
If you execute the above given snippet, it generates the following Output −
To create a point chart with X-axis at 5.5 on Y-axis on the above created data frame, add the following code to the above snippet −
plot(1:10,xaxt="n") axis(1,pos=5.5)
Output
If you execute all the above given snippets as a single program, it generates the following Output −
- Related Articles
- How to change the axis color in base R plot?
- How to change the Y-axis title in base R plot?
- How to change the axis ticks color in base R plot?
- How to display X-axis labels inside the plot in base R?
- How to display superscript for X-axis title in base R plot?
- How to display X-axis labels with dash in base R plot?
- How to display raise to the power on X-axis in base R plot?
- How to change the resolution of a plot in base R?
- How to create a plot in base R with dates sequence on X-axis?
- How to change the automatic sorting of X-axis of a bar plot using ggplot2 in R?
- How to change the background color of base R plot region?
- How to change the font size of legend in base R plot?
- How to change the background color of legend in base R plot?
- How to create a plot with tick marks between X-axis labels in base R?
- How to increase the X-axis length of histogram in base R?
