Adjusting axis annotations and tick marks

The default axis settings are often not adequate to deal with all kinds of data. For example, we might wish to change the number of tick marks along an axis or change the orientation of the annotations if they are too long in order to fit them horizontally. In this recipe, we will cover some settings that can be used to customize axes as per our requirements.

Getting ready

All you need to try out in this recipe is to run R and type the recipe in the command prompt. You can also choose to save the recipe as a script so that you can use it again later on.

How to do it...

We can set the xaxp and yaxp arguments with the par() command in order to specify coordinates of the extreme tick marks and the number of intervals ...

Get R: Data Analysis and Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.