

Dear all,
I am trying to display multivariate data using the library plot3D. I
have 3 variables that go on the axis and a fourth that I would like to
display as a color shade. However, the scale differs between plots
because the data I am using varies.
Would be possible to maintain a single scale so that the different
points will have the same shade on different plots? This would be like
giving the same axis scale on different plots.
For example, I got the following:
>>>>
set.seed(50)
x = runif(10, 6, 18)
y = runif(10, 5, 7)
z = runif(10, 0.7, 3.14)
k = runif(10, 0.5, 1.2)
w = runif(10, min(z, k), max(z,k))
df = my.data < data.frame(x, y, z, k, w)
library("plot3D")
X = df$x
Y = df$y
Z = df$z
K = df$k
W = df$w
scatter3D(X, Y, Z, col.var = Z, pch = 16, cex = 2)
scatter3D(X, Y, K, col.var = K, pch = 16, cex = 2)
<<<
In these plots the scale varies (0.60.9 in the first plot, 1.52.5 in
the second); I tried by creating a common scale with the variable W
which ranges from the min and max of the fourth levels represented by
the variables Z and K, but the result is the same:
scatter3D(X, Y, Z, col.var = W, pch = 16, cex = 2)
scatter3D(X, Y, K, col.var = W, pch = 16, cex = 2)
Essentially, I would like the variables Z and K to be shaded according
to a common scale so that I could evaluate the shades of the two plots
directly.
Would that be possible?
Thank you.

Best regards,
Luigi
______________________________________________
[hidden email] mailing list  To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.


Hi Luigi,
Upon careful reading of the help page, you can do it with scatter3D:
scatter3D(X, Y, Z, col.var = Z, pch = 16, cex = 2,clim=c(0.5,3))
scatter3D(X, Y, K, col.var = K, pch = 16, cex = 2,clim=c(0.5,3))
Jim
On Thu, Mar 14, 2019 at 9:32 PM Luigi Marongiu < [hidden email]> wrote:
>
> Dear all,
> I am trying to display multivariate data using the library plot3D. I
> have 3 variables that go on the axis and a fourth that I would like to
> display as a color shade. However, the scale differs between plots
> because the data I am using varies.
> Would be possible to maintain a single scale so that the different
> points will have the same shade on different plots? This would be like
> giving the same axis scale on different plots.
>
> For example, I got the following:
> >>>>
> set.seed(50)
> x = runif(10, 6, 18)
> y = runif(10, 5, 7)
> z = runif(10, 0.7, 3.14)
> k = runif(10, 0.5, 1.2)
> w = runif(10, min(z, k), max(z,k))
> df = my.data < data.frame(x, y, z, k, w)
>
> library("plot3D")
> X = df$x
> Y = df$y
> Z = df$z
> K = df$k
> W = df$w
> scatter3D(X, Y, Z, col.var = Z, pch = 16, cex = 2)
> scatter3D(X, Y, K, col.var = K, pch = 16, cex = 2)
> <<<
>
> In these plots the scale varies (0.60.9 in the first plot, 1.52.5 in
> the second); I tried by creating a common scale with the variable W
> which ranges from the min and max of the fourth levels represented by
> the variables Z and K, but the result is the same:
> scatter3D(X, Y, Z, col.var = W, pch = 16, cex = 2)
> scatter3D(X, Y, K, col.var = W, pch = 16, cex = 2)
>
> Essentially, I would like the variables Z and K to be shaded according
> to a common scale so that I could evaluate the shades of the two plots
> directly.
> Would that be possible?
> Thank you.
>
> 
> Best regards,
> Luigi
>
> ______________________________________________
> [hidden email] mailing list  To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/rhelp> PLEASE do read the posting guide http://www.Rproject.org/postingguide.html> and provide commented, minimal, selfcontained, reproducible code.
______________________________________________
[hidden email] mailing list  To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.


Thank you!
I even bought a manual on this and such feature was not there. Case solved.
Regards,
Luigi
On Thu, Mar 14, 2019 at 11:36 PM Jim Lemon < [hidden email]> wrote:
>
> Hi Luigi,
> Upon careful reading of the help page, you can do it with scatter3D:
>
> scatter3D(X, Y, Z, col.var = Z, pch = 16, cex = 2,clim=c(0.5,3))
> scatter3D(X, Y, K, col.var = K, pch = 16, cex = 2,clim=c(0.5,3))
>
> Jim
>
> On Thu, Mar 14, 2019 at 9:32 PM Luigi Marongiu < [hidden email]> wrote:
> >
> > Dear all,
> > I am trying to display multivariate data using the library plot3D. I
> > have 3 variables that go on the axis and a fourth that I would like to
> > display as a color shade. However, the scale differs between plots
> > because the data I am using varies.
> > Would be possible to maintain a single scale so that the different
> > points will have the same shade on different plots? This would be like
> > giving the same axis scale on different plots.
> >
> > For example, I got the following:
> > >>>>
> > set.seed(50)
> > x = runif(10, 6, 18)
> > y = runif(10, 5, 7)
> > z = runif(10, 0.7, 3.14)
> > k = runif(10, 0.5, 1.2)
> > w = runif(10, min(z, k), max(z,k))
> > df = my.data < data.frame(x, y, z, k, w)
> >
> > library("plot3D")
> > X = df$x
> > Y = df$y
> > Z = df$z
> > K = df$k
> > W = df$w
> > scatter3D(X, Y, Z, col.var = Z, pch = 16, cex = 2)
> > scatter3D(X, Y, K, col.var = K, pch = 16, cex = 2)
> > <<<
> >
> > In these plots the scale varies (0.60.9 in the first plot, 1.52.5 in
> > the second); I tried by creating a common scale with the variable W
> > which ranges from the min and max of the fourth levels represented by
> > the variables Z and K, but the result is the same:
> > scatter3D(X, Y, Z, col.var = W, pch = 16, cex = 2)
> > scatter3D(X, Y, K, col.var = W, pch = 16, cex = 2)
> >
> > Essentially, I would like the variables Z and K to be shaded according
> > to a common scale so that I could evaluate the shades of the two plots
> > directly.
> > Would that be possible?
> > Thank you.
> >
> > 
> > Best regards,
> > Luigi
> >
> > ______________________________________________
> > [hidden email] mailing list  To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/rhelp> > PLEASE do read the posting guide http://www.Rproject.org/postingguide.html> > and provide commented, minimal, selfcontained, reproducible code.

Best regards,
Luigi
______________________________________________
[hidden email] mailing list  To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.

