You'll want to play around with the arguments, but wireframe
is nice.
library(lattice)
d <- as.matrix(dat)
wireframe(d, scales = list(arrows = FALSE),
drape = TRUE, colorkey = TRUE,
screen = list(z = 30, x = -60))
Frage
I have some data:
> head(dat)
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14
1: 2 2 3 2 4 1 1 0 0 0 2 2 0 0
2: 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3: 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4: 0 0 0 0 0 1 0 0 0 0 0 0 0 0
5: 0 0 0 0 0 0 0 0 0 0 1 1 0 0
6: 0 0 0 0 0 0 0 0 0 0 0 0 0 0
How can I create a 3D plot of this data, so X axis would be V1:V14
, Y axis would be 1:6(Index)
and Z axis would be the value of V1[1]
?
When I try to plot I get:
> scatter3D(dat)
Error in range(y, na.rm = TRUE) : 'y' is missing
What should I parse as Y and Z?
Lösung
You'll want to play around with the arguments, but wireframe
is nice.
library(lattice)
d <- as.matrix(dat)
wireframe(d, scales = list(arrows = FALSE),
drape = TRUE, colorkey = TRUE,
screen = list(z = 30, x = -60))