Hello Erin.
I think I understand.

Those the following code solve your issue ?


#----------------------------------------

#Set up date for zoo object
 library(zoo)
 xdate <- seq(as.Date("2002-01-01"),as.Date("2010-06-30"),by="day")
 length(xdate)
 xt <- zoo(rnorm(3103),order=xdate)
 library(qcc)


 eplot2<-
function(x){
require(zoo)
require(qcc)
#dev.new()
plot(x)
z <- locator(2,type="l",col="red")
#dev.new()
par(mfrow = c(1,3))
plot(x)
points(z, ,type="l",col="red")
plot(window(x, start = min(z$x), end = max(z$x)),ylab=" ")
#dev.new()
ewma(window(x, start = min(z$x), end = max(z$x)),title=" ")

}
 eplot2(xt)

#----------------------------------------

(p.s: please keep the replaying also to the mailing list so everyone might
offer help/benefit from a solution)

Best,
Tal




----------------Contact
Details:-------------------------------------------------------
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Fri, Jul 30, 2010 at 9:19 PM, Erin Hodgess <erinm.hodg...@gmail.com>wrote:

> Absolutely.
>
>  #Set up date for zoo object
>  library(zoo)
>  xdate <- seq(as.Date("2002-01-01"),as.Date("2010-06-30"),by="day")
>  length(xdate)
>  xt <- zoo(rnorm(3103),order=xdate)
>  library(qcc)
>  eplot2
> function(x){
> require(zoo)
> require(qcc)
> dev.new()
> plot(x)
>
> z <- locator(2,type="l",col="red")
> dev.new()
> plot(window(x, start = min(z$x), end = max(z$x)),ylab=" ")
> dev.new()
> ewma(window(x, start = min(z$x), end = max(z$x)),title=" ")
>
> }
>  eplot2(xt)
>
> Okay.  The first graph appears.  The user selects 2 points as a
> subset.  Then I want to have 3 graphs appear simultaneously.  The
> first is the original graph with a line segment between the two
> points.  The second is the graph of the subset.  The third is the EWMA
> of the subset data.
>
> Thanks,
> Erin
>
>
>
> On Fri, Jul 30, 2010 at 10:13 AM, Tal Galili <tal.gal...@gmail.com> wrote:
> > Hi Erin,
> > Could you please add a simple self contained code for us to try and help
> you
> > with?
> > (giving us code with ">" doesn't help)
> > Best,
> > Tal
> >
> > ----------------Contact
> > Details:-------------------------------------------------------
> > Contact me: tal.gal...@gmail.com |  972-52-7275845
> > Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> > www.r-statistics.com (English)
> >
> ----------------------------------------------------------------------------------------------
> >
> >
> >
> >
> > On Thu, Jul 29, 2010 at 10:21 PM, Erin Hodgess <erinm.hodg...@gmail.com>
> > wrote:
> >>
> >> Dear R People:
> >>
> >> Now I have a function with 3 graphics windows.  I'd like for them all
> >> to be visible.  However, the first window goes blank.  Here is the
> >> basic setup.  The first plot is the entire series.  The user selects
> >> two points, which in turns generates a subset plot and an EWMA subset
> >> plot.  Finally, if things worked right, the user should be able to
> >> click on "Tile Vertically" and see all 3 windows.  Also, there should
> >> be a line segment on the original plot connecting the two selected
> >> points.
> >>
> >> > library(zoo)
> >> > xdate <- seq(as.Date("1998-01-01"),as.Date("2010-06-30"),by="day")
> >> > length(xdate)
> >> [1] 4564
> >> > xt <- zoo(rnorm(4564),order=xdate)
> >> > eplot
> >> function (x)
> >> {
> >>    x11()
> >>    plot(x)
> >>    z <- locator(2)
> >>    x11()
> >>    plot(window(x, start = min(z$x), end = max(z$x)))
> >>  dev.set(dev.prev())
> >> segments(z$x[1],z$y[1],z$x[2],z$y[2],col="red")
> >>        dev.set(dev.next())
> >>    x11()
> >>    ewma(window(x, start = min(z$x), end = max(z$x)))
> >>    dev.set(dev.prev())
> >>    return(z)
> >> }
> >> > eplot(xt)
> >> $x
> >> [1]  9400.369 11592.073
> >>
> >> $y
> >> [1] 3.641633 3.353061
> >>
> >> >
> >>
> >> How do I get that original plot to appear without losing any of the
> >> other plots, please?
> >>
> >> Thanks,
> >> Erin
> >>
> >> --
> >> Erin Hodgess
> >> Associate Professor
> >> Department of Computer and Mathematical Sciences
> >> University of Houston - Downtown
> >> mailto: erinm.hodg...@gmail.com
> >>
> >> ______________________________________________
> >> R-help@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.
> >
> >
>
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodg...@gmail.com
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to