Fair enough, thank you. On Thu, Feb 28, 2019 at 4:56 PM Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: > > You are missing the point... lattice assembles the entire data set at once so > it can adjust and synchronize all of the scales and then it generates an > object that can be printed to a device. This approach is entirely > incompatible with the base graphics approach of keeping global variables > around that help successive functions cooperate to cumulatively build up an > image. > > You need to get all your points into the lattice call initially. which may > involve changing how you structure the data before you create the plot. Read > the vignette and some tutorials. > > On February 28, 2019 7:38:52 AM PST, Luigi Marongiu > <marongiu.lu...@gmail.com> wrote: > >I see. I have been thinking of superimposing two plots with > >par(new=TRUE), but how could I remove all the graphic parameters > >(axes, background etc) keeping only the actual points in lattice? (if > >possible). > >Tx > > > >On Thu, Feb 28, 2019 at 3:53 PM Duncan Murdoch > ><murdoch.dun...@gmail.com> wrote: > >> > >> On 28/02/2019 5:39 a.m., Luigi Marongiu wrote: > >> > Dear all, > >> > is it possible to add points to a lattice cloud plot (3D scatter)? > >I > >> > can plot the main data, but what if I wanted to add another point. > >In > >> > R there is the high level plotting function plot(), then the low > >level > >> > points() or lines() etc. What is the equivalent for lattice? > >> > >> I don't know for sure, but I don't think you can do that in lattice. > >> The scatterplot3d::scatterplot3d function returns enough information > >to > >> do this, but I don't think lattice::cloud does. But even > >> scatterplot3d::scatterplot3d won't necessarily get it right if points > >> hide others that are behind them. It uses the "painter's algorithm", > >> and that needs everything to be drawn in just the right order, which > >you > >> probably won't get if you draw things in several calls. > >> > >> You can draw things in arbitrary order using rgl::plot3d or related > >> functions, but you'll need to do more work yourself to get an array > >of > >> plots like lattice gives. > >> > >> Duncan Murdoch > >> > >> > >> > > >> > Thank you > >> > > >> > > >> >>>> > >> > > >> > df = data.frame(Name = c("A", "B", "C", "D", "E"), > >> > x_axis = c(-0.591, 0.384, -0.384, -0.032, 0.754), > >> > y_axis = c(-1.302, 1.652, -1.652, 0.326, 0.652), > >> > z_axis = c(1.33, 1.33, 2.213, 0.032, -0.754), > >> > stringsAsFactors = FALSE) > >> > > >> > cloud(z_axis ~ x_axis * y_axis, data = df, > >> > xlab = "X", ylab = "Y", zlab = "Z", > >> > pch = 16, col = "red", type = "b", cex = 1.5, > >> > ltext(x=df$x_axis, y=df$y_axis, z=df$z_axis, > >> > labels=df$Names, pos=1, offset=1, cex=0.8) > >> > ) > >> > > >> > df2 = data.frame(Name = "F", > >> > x_axis = 0.891, > >> > y_axis = 2.302 > >> > z_axis = -1.83, > >> > stringsAsFactors = FALSE) > >> > > >> > > -- > Sent from my phone. Please excuse my brevity.
-- Best regards, Luigi ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.