Adding axis to a Plot in R programming - axis () Function Last Updated : 14 Jul, 2020 Comments Improve Suggest changes Like Article Like Report 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 # 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) 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 # 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() 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 # 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) Output: Here, the different type of axis are drawn implementing modification in line width(lwd) and line type(lty). Comment More infoAdvertise with us Next Article Adding axis to a Plot in R programming - axis () Function K kaurbal1698 Follow Improve Article Tags : R Language R Plot-Function Similar Reads Addition of Lines to a Plot in R Programming - lines() Function In R, the lines() function is called to add on top of already existing plot. This is particularly helpful when you want to add more lines, such as trend lines, regression lines, or special lines, on a plot. The lines() function allows flexibility in line color, line width, and line type, with multip 3 min read Adding Text to Plots in R programming - text() and mtext () Function Text is defined as a way to describe data related to graphical representation. They work as labels to any pictorial or graphical representation.1. text() Function in Rtext() Function in R Programming Language is used to draw text elements to plots in Base R.Syntax: text(x, y, labels)Parameters:Â x an 3 min read Adding Straight Lines to a Plot in R Programming - abline() Function abline() function in R Language is used to add one or more straight lines to a graph. The abline() function can be used to add vertical, horizontal or regression lines to plot. Syntax: abline(a=NULL, b=NULL, h=NULL, v=NULL, ...) Parameters: a, b: It specifies the intercept and the slope of the line 2 min read Addition of more points to a Plot in R Programming - points() Function points() function in R Language is used to add a group of points of specified shapes, size and color to an existing plot. Syntax: points(x, y, cex, pch, col) Parameters: x, y: Vector of coordinates cex: size of points pch: shape of points col: color of points Sample Scatter Plot: Python3 1== # R pro 2 min read Add elements to existing plotly plot in R Plotly is a powerful library in R for creating interactive, web-based visualizations. It allows users to transform static plots into dynamic and interactive graphics, making data exploration more engaging and insightful. This article will guide you through the process of adding elements to existing 3 min read Like