**Daniel MarcelinoDaniel Marcelino » R**, and kindly contributed to R-bloggers)

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...