Skip to content

Editable plot

1 message · Jim Lemon

#
Hi Ishaq,
Well, you could do something absolutely ridiculous like this:

edit_my_plot<-function(x,y,z,w,r) {
 npoints<-length(r)
 index<-1
 while(length(index)) {
  matplot(x=matrix(r,nrow=3,ncol=4),y=cbind(x,y,z,w),
   xlab="Number of iteration",ylab="Bias",
   type="b",pch=c(1,22,22,22),lwd=2,
   col=c("blue","red","green","forestgreen"))
  title(main="Estimated Bias for the optimal response ",
   col.main="red",font.main=4)
  text(rep(1000,4),c(0.15,1.10,1.52,1.4),c("PM","VM","WMSE","LT"))
  cat("Click on the point you want to move\n")
  index<-identify(rep(r,4),c(x,y,z,w),n=1,plot=FALSE)
  if(length(index)) {
   cat("Now click where you want to move it\n")
   newxy<-locator(n=1)
   if(index < npoints + 1) {
    x[index]<-newxy$y
    r[index]<-newxy$x
   }
   else {
    if(index < 2 * npoints + 1) {
     y[index-npoints]<-newxy$y
     r[index-npoints]<-newxy$x
    }
    else {
     if(index < 3 * npoints + 1) {
      z[index-2*npoints]<-newxy$y
      r[index-2*npoints]<-newxy$x
     }
     else {
      w[index-3*npoints]<-newxy$y
      r[index-3*npoints]<-newxy$x
     }
    }
   }
  }
 }
}

Jim
On Fri, May 1, 2015 at 5:25 AM, David L Carlson <dcarlson at tamu.edu> wrote: