# [R] tick mark intervals

Duncan Murdoch murdoch at stats.uwo.ca
Sun Mar 19 20:03:17 CET 2006

```On 3/19/2006 1:44 PM, Hadassa Brunschwig wrote:
> Hi everyone!
>
> This must be a common question but I have not found an answer to it in the
> archives yet.
>
> I am producing four plots with par(mfrow=c(2,2)). The x-axis is the same for
> all of them but the y-axis is different.
> What I would like to do is to have a different range of the y-axis and
> different intervals between tick marks. BUT
> I would like to have the same number of tick marks and I would like the
> y-axis to look the same.
>
> EXAMPLE (with two plots):
>
> plot1:         number of tick marks = 11
>                  interval between tick marks = 5 (i.e. tick marks at
> 0,5,10,15, etc.)
>                  range of y-axis = (0, 50)
>
> plot2:         number of tick marks = 11
>                  interval between tick marks = 10 (i.e. tick marks at
> 0,10,20,etc.)
>                  range of y-axis = (0,100)
>
>
> Now I can obtain the values at which there should be tick marks for each of
> the above plots. The problem is that
> when I plot them with par(mfrow=c(1,2)) I obtain the same graphical height
> for each y-axis but the y-axis of plot1
> has no tick marks after the value of 50 which looks ugly. I would like to
> stretch the 50 of plot1 to where the 100
> of plot2 is such that the it looks evenly distributed. But that means that
> an interval between tick mark 1 and 2 of plot1
> (which is 5) is as long (graphically) as the interval between tick mark 1
> and 2 of plot2 (which is 10).
>
> Any ideas on how to do this?

The ylim argument to plot controls the y-axis range.  If it doesn't give
you enough control, then plot with axes=F, and use the axis() and box()
functions to make your plot look exactly the way you want.

Duncan Murdoch

```