[R] add points to lattice cloud plot (3D scatter)
Luigi Marongiu
m@rong|u@|u|g| @end|ng |rom gm@||@com
Thu Feb 28 13:58:16 CET 2019
Thank uyou, but ?llines gives a method for 2 d plot:
llines(x, y = NULL, ...
when I try to plot 3 variables I get NULL as a result
On Thu, Feb 28, 2019 at 12:52 PM Michael Dewey <lists using dewey.myzen.co.uk> wrote:
>
> Not sure whether this helps but try
>
> library(lattice)
> ?llines
>
> Note that is indeed a double ll at the start
>
> Michael
>
> On 28/02/2019 10:39, 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?
> >
> > 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)
> >
>
> --
> Michael
> http://www.dewey.myzen.co.uk/home.html
--
Best regards,
Luigi
More information about the R-help
mailing list