
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 Axes Labels Using Plot Function in R
In a plot, the axes labels help us to understand the range of the variables for which the plot is created. While creating a plot in R using plot function, the axes labels are automatically chosen but we can change them. To do this, firstly we have to remove the axes then add each of the axes with the labels we want and then create the box for the plot.
Example
Consider the below data −
> x<-1:10 > y<-c(12,24,18,20,25,27,24,28,18,30)
Creating the scatterplot between x and y −
> plot(x,y)
Output
Changing the axes labels for X and Y axes −
> plot(x,y,axes=FALSE)+ + axis(side = 1, at = c(2,5,10))+ + axis(side = 2, at = c(20,25,30))+ + box()