[R] Odp: identify with mfcol=c(1,2)
Petr PIKAL
petr.pikal at precheza.cz
Thu Apr 5 10:06:20 CEST 2012
Hi
It seems to me that probably split.screen or layout is preferable if you
want specify graph for identification. But I am not an expert in this and
after some testing identification does not work well with splitted screen.
So you are probably out of luck.
Regards
Petr
>
> Please forgive my re-sending this question. I did not see any replies
from
> my prior post. My apologies if I missed something.
>
> I would like to have a figure with two graphs. This is easily
accomplished
> using mfcol:
>
> oldpar <- par(mfcol=c(1,2))
> plot(x,y)
> plot(z,x)
> par(oldpar)
>
> I run into trouble if I try to use identify with the two plots. If,
after
> identifying points on my first graph I hit the ESC key, or hitting stop
> menu bar of my R session, the system stops the identification process,
but
> fails to give me my second graph. Is there a way to allow for the
> identification of points when one is plotting to graphs in a single
graph
> window? My code follows.
>
> plotter <- function(first,second) {
> # Allow for two plots in on graph window.
> oldpar<-par(mfcol=c(1,2))
>
> #Bland-Altman plot.
> plot((second+first)/2,second-first)
> abline(0,0)
> # Allow for indentification of extreme values.
> BAzap<-identify((second+first)/2,second-first,labels =
seq_along(data$Line))
> print(BAzap)
>
> # Plot second as a function of first value.
> plot(first,second,main="Limin vs. Limin",xlab="First
(cm^2)",ylab="Second (cm^3)")
> # Add identity line.
> abline(0,1,lty=2,col="red")
> # Allow for identification of extreme values.
> zap<-identify(first,second,labels = seq_along(data$Line))
> print(zap)
> # Add regression line.
> fit1<-lm(first~second)
> print(summary(fit1))
> abline(fit1)
> print(summary(fit1)$sigma)
>
> # reset par to default values.
> par(oldpar)
>
> }
> plotter(first,second)
>
>
> Thanks,
> John
>
>
>
>
>
>
> 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 th...{{dropped:6}}
>
> ______________________________________________
> 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.
More information about the R-help
mailing list