# Re: [R] Problem having tick marks aligned when plotting three graphs on top of one another.

From: Richard M. Heiberger <rmh_at_temple.edu>
Date: Sat, 23 Apr 2011 00:09:47 -0400

John,

you need ylim for that capability.

Rich

```     Slope PctCont PctCat PctTTst
0.05     7.4    5.6     6.3
0.10    17.7   11.3    13.3
0.15    32.7   18.7    25.6
0.20    53.3   27.5    40.2
0.25    72.1   41.2    54.5
0.30    85.5   52.9    70.8
0.35    93.9   65.2    83.6
0.40    97.0   73.6    89.9
0.45    99.7   84.8    96.5
0.50    99.9   90.1    98.4
0.55   100.0   93.2    99.7
0.60   100.0   97.3    99.8
0.65   100.0   98.8   100.0
0.70   100.0   99.4   100.0
0.75   100.0   99.8   100.0
0.80   100.0   99.7   100.0
0.85   100.0  100.0   100.0
0.90   100.0  100.0   100.0
```

0.95 100.0 100.0 100.0
1.00 100.0 100.0 100.0
par(mfrow=c(1,1))
plot(tmp[,"Slope"],tmp[,"PctCont"],type="b",yaxp=c(0,100,10), ylim=c(0,100), ylab="prevent overlap")
par(new=TRUE)
plot(tmp[,"Slope"],tmp[,"PctCat"],type="b",yaxp=c(0,100,10), ylim=c(0,100), ylab="")
par(new=TRUE)
plot(tmp[,"Slope"],tmp[,"PctTTst"],type="b",yaxp=c(0,100,10), ylim=c(0,100), ylab="")

On Fri, Apr 22, 2011 at 11:55 PM, John Sorkin <jsorkin_at_grecc.umaryland.edu>wrote:

> R 2.10
> Windows 7
>
> I am trying to plot three graphs on top of each other. I need to have the
> axises perfectly aligned. For some reason the ticks on the y axes are
> slightly off so they do not perfectly align. Can someone tell me how I can
> get the to overlay each other perfectly? I thought the yaxp parameter would
> solve my problem, but it does not. My data and code follows:

[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 23 Apr 2011 - 04:12:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 23 Apr 2011 - 04:20:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.