Change Axis Range in R: xlim & ylim

In R language, the plot axis range can be changed using the functions xlim and ylim.

For example, if you want to set the range of the x-axis from 0 to 10 and the range of the y-axis from 0 to 20, you can use the following code:

plot(x, y)
xlim(c(0, 10))
ylim(c(0, 20))

plot(x, y) is the command used to plot the graph, with c(0, 10) and c(0, 20) indicating the ranges of the x-axis and y-axis respectively.

bannerAds