On Wed, May 29, 2013 at 7:57 AM, Stefan Lüdtke <slued...@gfz-potsdam.de>wrote:

>
> x=runif(100, 1, 2)
> y=runif(100, 2, 4)
> z=runif(100, 1, 4)
>
> data_xyz=as.data.frame(cbind(x, y, z, a=rep(c(1:10), 10), b=rep(c(1:2),
> each=50)))
>
> custom.panel = function(x, y, z, subscripts, ...)
> {
> highlight=(data_xyz$a == 1)
>      highlight.panel = highlight[subscripts]
>
> panel.cloud(x[highlight.panel], y[!highlight.panel], z[!highlight.panel],
>              type='p', pch=18)
> panel.cloud(x[highlight.panel], y[highlight.panel], z[highlight.panel],
>              type='b', col="tomato3")
> }
>
>
If you >args(panel.cloud) or ?panel.cloud you'll notice the order is "x , y
, subscripts , z ,..." *not* x,y,z, hence the error message "z not found"
or something to that effect you should have been getting. In any case
you're code is IMHO a little clunky with groups=TRUE and a panel function
just to get the groups condition. Would something like this do the  job?

cloud(z~x*y|b, groups=factor(a==1), data=data_xyz, pch=c(1,19), type='b',
par.settings=list(superpose.line=list(col=c(0,"#ff00ff"))))



> #that works of course
> cloud(z~x*y|b, data=data_xyz)
>
> #that not
> cloud(z~x*y|b, data=data_xyz, groups=TRUE,
> panel=custom.panel)
>
>
> ##################################################################
>
> On 05/29/2013 03:36 PM, John Kane wrote:
> > No attachment.  The R-help list tendst to strip out many type of
> attached files though pdf and txt , among others get through.
> >
> > It is better to supply the example in the email itself if possible. Have
> a look at https://github.com/hadley/devtools/wiki/Reproducibility for
> suggestions.
> >
> > John Kane
> > Kingston ON Canada
> >
> >
> >> -----Original Message-----
> >> From: slued...@gfz-potsdam.de
> >> Sent: Tue, 28 May 2013 15:50:33 -0700 (PDT)
> >> To: r-help@r-project.org
> >> Subject: [R] highlight points in lattice cloud plot
> >>
> >> Dear list,
> >>
> >> I am
> >>   struggling with the following problem.
> >>
> >> In a 2d case I managed to highlight a subset of points  through the
> >> panel.xyplot function.
> >>
> >> However, I was trying the same in 3d using panel.cloud, but now luck.
> >>
> >> I attached a minimal example, I think the first plot shows the idea.
> >>
> >> Thanks,
> >>
> >> Stefan
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://r.789695.n4.nabble.com/highlight-points-in-lattice-cloud-plot-tp4668157.html
> >> Sent from the R help mailing list archive at Nabble.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.
> > ____________________________________________________________
> > FREE ONLINE PHOTOSHARING - Share your photos online with your friends
> and family!
> > Visit http://www.inbox.com/photosharing to find out more!
> >
> >
>
>
>         [[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.
>

        [[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