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}}
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}}
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 repliesfrom> my prior post. My apologies if I missed something. > > I would like to have a figure with two graphs. This is easilyaccomplished> 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 singlegraph> 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 guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
I tried your code, first I removed the reference to the global variable data$Line, then it works if I finish identifying by either right clicking (I am in windows) and choosing stop, or using the stop menu. It does as you say if I press escape or use the stop sign button (both stop the whole evaluation rather than just the identifying). On Tue, Apr 3, 2012 at 8:52 AM, John Sorkin <jsorkin at grecc.umaryland.edu> wrote:> 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 ...{{dropped:15}}
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)>>> Greg Snow <538280 at gmail.com> 4/5/2012 4:37 PM >>>I tried your code, first I removed the reference to the global variable data$Line, then it works if I finish identifying by either right clicking (I am in windows) and choosing stop, or using the stop menu. It does as you say if I press escape or use the stop sign button (both stop the whole evaluation rather than just the identifying). On Tue, Apr 3, 2012 at 8:52 AM, John Sorkin <jsorkin at grecc.umaryland.edu> wrote:> 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 ...{{dropped:23}}