0

I want to use rgl.surface(x,z,y...) to draw a 3d graph.

However, my z axis is not numeric, like Mon, Tues, Wens....

So how can I use rgl.surface, or other functions to draw a graph?

slavoo
  • 5,798
  • 64
  • 37
  • 39
Feng Chen
  • 2,139
  • 4
  • 33
  • 62
  • the shape of your surface will depend of the (arbitrary) position on your `z` axis and I'm not sure that would lead to something you can use. Couldn't you plot separate curves (varying on `x` and `y`) for different `z`s instead? Why would you need to "unite" them in a surface? – Vincent Bonhomme May 18 '16 at 08:50
  • So try and post a minimal example in the future and you will avoid those pesky downvotes (the upvote was from me - think it was a good question). – Mike Wise May 25 '16 at 08:07

1 Answers1

2

Simply convert your axis to a numeric range, e.g.

 z <- c("Mon", "Tues", "Wed")
 zn <- seq_along(z)

You can then use zn in any plotting function. You'll need to draw axes manually to include the appropriate labels.

For example,

 x <- y <- 1:3
 plot3d(x, y, zn, axes = FALSE)
 box3d()
 axis3d("x")
 axis3d("y")
 axis3d("z", at=zn, labels=z)

enter image description here

Mike Wise
  • 22,131
  • 8
  • 81
  • 104
user2554330
  • 37,248
  • 4
  • 43
  • 90