# How to create a plot with tick marks between X-axis labels in base R?

R ProgrammingServer Side ProgrammingProgramming

#### Artificial Intelligence : The Future Of Programming

15 Lectures 54 mins

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### C Programming from scratch- Master C Programming

Best Seller

60 Lectures 8 hours

To create a plot with tick marks manually between X-axis values in base R, we first need to create the plot without X-axis labels then add the axis values using axis function with appropriate labels, this will create tick marks as well as labels. After this step, we would need to use the axis function again to add the tick marks without labels.

## Example

Live Demo

plot(1:10,xaxt='n',type="l")
axis(1,at=1:10)
axis(1,at=seq(0,11,0.2),labels=NA)

## Example

Live Demo

plot(1,xaxt='n')
axis(1,at=1)
axis(1,at=seq(0,2,0.05),labels=NA)

## Output

Updated on 08-Dec-2020 06:37:28