** axis()** function in R Language is to add axis to a plot. It takes side of the plot where axis is to be drawn as argument.

Syntax:

axis(side, at=NULL, labels=TRUE)

Parameters:

side:It defines the side of the plot the axis is to be drawn on possible values such as below, left, above, and right.

at:Point to draw tick marks

labels:Specifies texts for tick-mark labels.

**Example 1:**

`# R program to draw axis in a plot ` `x <- 1:5; y = x * x ` `plot` `(x, y, axes = ` `FALSE` `) ` ` ` `# Calling the axis() function ` `axis` `(side = 1, at = 1:5, labels = ` `LETTERS` `[1:5]) ` `axis` `(3) ` |

*chevron_right*

*filter_none*

**Output:**

In the above example, the straight dotted line is added to the plot joining numerical and alphabetical values plot axis is drawn at the top and bottom part of the plot.

**Example 2:** Another example to add axes by drawing box

`# R program to draw axis to a plot ` `x<-1:5; y = x * x ` `plot` `(x, y, axes = ` `FALSE` `) ` `axis` `(side=1, at = 1:5, labels = ` `LETTERS` `[1:5]) ` `axis` `(3) ` ` ` `#- To make it look like "usual" plot ` `box` `() ` |

*chevron_right*

*filter_none*

**Output:**

Here, a box is drawn to drawn using **box()** function around the axis so that it looks like a usual plot.

**Example 3:**

`# R program to draw axis to a plot ` `x<-1:4; y=x*x ` `plot` `(x, y, pch = 18, col = ` `"darkgreen"` `, type = ` `"b"` `, ` ` ` `frame = ` `FALSE` `, xaxt = ` `"n"` `) ` ` ` `# Remove x axis ` `axis` `(1, 1:4, ` `LETTERS` `[1:4], col.axis=` `"blue"` `) ` `axis` `(3, col = ` `"darkgreen"` `, lty = 2, lwd = 4) ` `axis` `(4, col = ` `"black"` `, col.axis = ` `"blue"` `, lwd = 4) ` |

*chevron_right*

*filter_none*

**Output:**

Here, the different type of axis are drawn implementing modification in line width(lwd) and line type(lty).

## Recommended Posts:

- Set Aspect Ratio of Scatter Plot and Bar Plot in R Programming - Using asp in plot() Function
- Adding Straight Lines to a Plot in R Programming - abline() Function
- Addition of more points to a Plot in R Programming - points() Function
- Addition of Lines to a Plot in R Programming - lines() Function
- Add Color Between Two Points of Kernel Density Plot in R Programming - Using with() Function
- Plot Arrows Between Points in a Graph in R Programming - arrows() Function
- Plot a Geometric Distribution Graph in R Programming - dgeom() Function
- Draw a Quantile-Quantile Plot in R Programming - qqline() Function
- Create a Plot Matrix of Scatterplots in R Programming - pairs() Function
- Plotting of Data using Generic plots in R Programming - plot() Function
- Adding Noise to a Numeric Vector in R Programming - jitter() Function
- Adding Text to Plots in R programming - text() and mtext () Function
- Adding elements in a vector in R programming - append() method
- Adding Colors to Charts in R Programming
- Check if a Function is a Primitive Function in R Programming - is.primitive() Function
- Compute Density of the Distribution Function in R Programming - dunif() Function
- Apply a Function over a List of elements in R Programming - lapply() Function
- Search the Interval for Minimum and Maximum of the Function in R Programming - optimize() Function
- Compute the Natural Logarithm of the Absolute Value of Gamma Function in R Programming - lgamma() Function
- Compute the Logarithmic Derivative of the gamma Function in R Programming - digamma() Function

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.