0

I have this data frame called t:

dput(t)
structure(list(timestamp = structure(c(1466306383, 1466306445, 
1466306507, 1466306569, 1466306631, 1466306693, 1466306755, 1466306817, 
1466306879, 1466306943, 1466307006, 1466307068, 1466307130, 1466307193, 
1466307255, 1466307317, 1466307379, 1466307442, 1466307504, 1466307566
), class = c("POSIXct", "POSIXt"), tzone = ""), cpuused = c(1.13007, 
1.13007, 1.13002, 1.12996, 1.1299, 1.12985, 1.12979, 1.12976, 
1.1297, 1.12965, 1.12959, 1.12953, 1.12947, 1.12942, 1.12936, 
1.1293, 1.12927, 1.12921, 1.12915, 1.1291), transratepersec = c(2640.77, 
2640.61, 2640.44, 2640.28, 2640.12, 2639.95, 2639.79, 2639.69, 
2639.53, 2639.36, 2639.19, 2639.03, 2638.86, 2638.7, 2638.54, 
2638.37, 2638.21, 2638.04, 2637.88, 2637.72), reqpersec = c(0.172818, 
0.172806, 0.172793, 0.172779, 0.172766, 0.172752, 0.172739, 0.172727, 
0.172714, 0.1727, 0.172687, 0.172673, 0.17266, 0.172646, 0.172633, 
0.17262, 0.172608, 0.172594, 0.172581, 0.172567), resptime = c(0.274, 
0.235, 0.234, 0.234, 0.236, 0.234, 0.235, 0.236, 0.236, 0.233, 
0.267, 0.235, 0.243, 0.235, 0.232, 0.233, 0.31, 0.233, 0.26, 
0.234)), .Names = c("timestamp", "cpuused", "transratepersec", 
"reqpersec", "resptime"), row.names = c(11653L, 19385L, 2624L, 
16106L, 13990L, 12724L, 9490L, 12720L, 19387L, 11656L, 13988L, 
9488L, 11650L, 5639L, 16104L, 15090L, 17156L, 4856L, 12722L, 
382L), class = "data.frame")

I would like to create a 3 dimensional chart with x=reqpersec, y=cpuused, z=transrateperse, having different colors of x,y and x,z.

I have tried this:

library(rgl)
attach(t)

plot3d(x=reqpersec, y=cpuused, z=transratepersec, type="p", col="red", xlab="ReqPerSec", ylab="CPU", zlab="TransRate", size=5, lwd=15, box=F)

It is only giving me one color. Any ideas how to easily do this?

I would like images to be similar to this:

enter image description here

user1471980
  • 10,127
  • 48
  • 136
  • 235
  • 1
    Perhaps a duplicate of [here](http://stackoverflow.com/questions/8013217/3d-plotting-in-r-using-a-4th-dimension-of-color)? You only specify `col="red"`... – Christoph Jul 14 '16 at 15:46
  • @Christoph, I tried the solution you posted, but it is one dimensional colors. I need to be able to see the color in 3 dimensional surface, between x and y and z and y. – user1471980 Jul 14 '16 at 16:02
  • 1
    I don't understand what you expect the graph to look like. Can you give an example (perhaps a screenshot from somewhere else)? – Christoph Jul 14 '16 at 16:05
  • @Christoph, I just updated the post with a sample image. Does that help? – user1471980 Jul 14 '16 at 16:48
  • Sorry, now I would need to understand you data :-( Perhaps that [link](https://plot.ly/r/reference/#surface) helps? I think you have to look for a surface plot. However, you need to transform your z-data to a 2D array. – Christoph Jul 15 '16 at 07:09

0 Answers0