- 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 X-axis labels with dash in base R plot?
To display X-axis labels with dash in base R plot, we can use axis function and define the labels manually. For this purpose, we can first create the plot without X-axis labels by using the argument xaxt="n" and then use the axis function.
Check out the below example to understand how it can be done.
Example
In order to display X-axis labels with dash in base R plot, use the following code −
plot(5,5)
Output
If you execute all the above given codes as a single program, it generates the following output −
In order to display X-axis labels with dash in base R plot, add the following code to the above code −
plot(5,5,xaxt="n")
Output
If you execute all the above given codes as a single program, it generates the following output −
In order to display X-axis labels with dash in base R plot, add the following code to the above code −
plot(5,5,xaxt="n") axis(1,at=c(3:7),labels=c("0-10","11-30","31-70","71-90","91-101"))
Output
If you execute all the above given codes as a single program, it generates the following output −
- Related Articles
- How to display X-axis labels inside the plot in base R?
- How to create a plot with tick marks between X-axis labels in base R?
- How to display superscript for X-axis title in base R plot?
- How to create a plot with reversed Y-axis labels in base R?
- 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 create a plot in base R with dates sequence on X-axis?
- How to use mtext function to create the X-axis labels in base R?
- How to display positive sign for X-axis labels in R using ggplot2?
- How to plot the X-axis labels on the upper-side of the plot in R?
- How to change the position of X-axis in base R plot?
- How to display text in base R plot with outline?
- How to display mean with underline in base R plot?
- How to display Y-axis labels with more decimal places in R?
- How to X-axis labels to the top of the plot using ggplot2 in R?
