**Daniel MarcelinoDaniel Marcelino » R**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

A colleague asked me for how one can change axis attributes in a basic plot. Plotting anything in R is really, really easy. It is enough typing `plot(x, y)`

. In general, plot functions are nicely pre-cooked, so hardly one needs to change anything. But if changes in the default attributes are needed, it is possible to achieve by including extra information to the basic syntax, like as: `plot(x, y, yaxs = "i")`

. Actually, we can change everything in the basic chart. To see how, just take a time yourself and type:` ?plot`

, then you can unfold several specific topics as: ?axis etc. You will see how wealthy are the resources available.

In the plot below, I plotted 6 scatterplots in only one object specially to show the chart manipulation. In the first scatterplot: top-left-hand I show the result of a default plot. In the middle plot of the same row, there is a version without the two axes. I setup this by passing the argument: `axis=FALSE`

in the command line. The third plot, in the top-right-hand, I added the x-axis just as it is. That is, without any manipulation of the numerical scale. In the fouth plot at bottom-left-hand, I added the y-axis to the plot, but still without manipulation. Finally, in the middle plot in the same second row, I added a y-axis where I manipulated not only the sacle by setting up my own “yticks” values, but also the colour and the position of the numbers in the axis. In the last plot, I also manipulated the scale of the x-axis to range from 0 to 3 by .5. The syntax of this example is shown bellow the chart.

**leave a comment**for the author, please follow the link and comment on their blog:

**Daniel MarcelinoDaniel Marcelino » R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.