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

From: Jorge Ivan Velez <jorgeivanvelez_at_gmail.com>
Date: Sat, 23 Apr 2011 00:13:32 -0400

Hi Dr. Sorkin,

One way of doing what you want is via matplot():

with(d, matplot(Slope, d[, -1], type = 'l', lty = 1))

where "d" is your data.

HTH,
Jorge

On Fri, Apr 22, 2011 at 11:55 PM, John Sorkin <> 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:
>
> > summaryresults[1:20,]
> Slope PctCont PctCat PctTTst
> [1,] 0.05 7.4 5.6 6.3
> [2,] 0.10 17.7 11.3 13.3
> [3,] 0.15 32.7 18.7 25.6
> [4,] 0.20 53.3 27.5 40.2
> [5,] 0.25 72.1 41.2 54.5
> [6,] 0.30 85.5 52.9 70.8
> [7,] 0.35 93.9 65.2 83.6
> [8,] 0.40 97.0 73.6 89.9
> [9,] 0.45 99.7 84.8 96.5
> [10,] 0.50 99.9 90.1 98.4
> [11,] 0.55 100.0 93.2 99.7
> [12,] 0.60 100.0 97.3 99.8
> [13,] 0.65 100.0 98.8 100.0
> [14,] 0.70 100.0 99.4 100.0
> [15,] 0.75 100.0 99.8 100.0
> [16,] 0.80 100.0 99.7 100.0
> [17,] 0.85 100.0 100.0 100.0
> [18,] 0.90 100.0 100.0 100.0
> [19,] 0.95 100.0 100.0 100.0
> [20,] 1.00 100.0 100.0 100.0
> >
> plot(summaryresults[,"Slope"],summaryresults[,"PctCont"],type="b",yaxp=c(0,100,10))
> > par(new=TRUE)
> >
> plot(summaryresults[,"Slope"],summaryresults[,"PctCat"],type="b",yaxp=c(0,100,10))
> > par(new=TRUE)
> >
> plot(summaryresults[,"Slope"],summaryresults[,"PctTTst"],type="b",yaxp=c(0,100,10))
>
>
> John David Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
> Confidentiality Statement:
> This email message, including any attachments, is for ...{{dropped:13}}



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:15:46 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.

list of date sections of archive