This may have been asked before and I've even used the online tutorial available for plotly here: https://plot.ly/r/3d-surface-plots/#multiple-surfaces
But I am still having issues. I want to create multiple surfaces on one plot just like in the tutorial I linked above. The only difference is that I have 4 small matrices as follows:
matrix 1 (line313C):
0.521025641 18 0
0 25 0
0.914285714 18 1
0.328461538 25 1
matrix 2 (line832C):
0.63 18 0
0.38 25 0
0.99 18 1
0.251578947 25 1
matrix 3 (line730C):
0.107222222 18 0
0.21 25 0
1 18 1
0.549226006 25 1
matrix 4 (line380C):
0.13 18 0
0.01 25 0
0.933918129 18 1
0.938421053 25 1
Using the following code:
cold3Dplot <- plot_ly(showscale = FALSE) %>%
add_surface(z = ~line313C) %>%
add_surface(z = ~line380C, opacity = 0.98) %>%
add_surface(z = ~line730C, opacity = 0.98) %>%
add_surface(z = ~line832C, opacity = 0.98)
cold3Dplot
I get this:
Not even close to what I was expecting. The axes ranges do not even look right at all as one should be between 0 and 1, one between 18 and 25, and one from 0 to 1 (whole numbers - actually 0 or 1). Moreover, there is only 1 surface, not 4. I am not entirely sure what the issue is as I followed the tutorial.
############# EDIT:I was able to create this plot using wireframe in R:
using this data:
line surv temp stage
313 0.521025641 18 L
313 0 25 L
313 0.914285714 18 A
313 0.328461538 25 A
832 0.63 18 L
832 0.38 25 L
832 0.99 18 A
832 0.251578947 25 A
730 0.107222222 18 L
730 0.21 25 L
730 1 18 A
730 0.549226006 25 A
380 0.13 18 L
380 0.01 25 L
380 0.933918129 18 A
380 0.938421053 25 A
and the following code:
wireframe(surv~stage*temp, data=cold3D_top4, group=line,
col.groups=c("red","green","blue","purple"),
scales = list(arrows=FALSE, col="black",font=10),
xlab = list("Life Stage",rot=30, mgp=c(2)),
ylab = list("Rearing Temperature",rot=-40),
zlab = list("Survival",rot=90),
zlim = c(0,1),
ylim = c("18","25"),
par.settings = list(regions=list(alpha=0.75)))
This is what I want just in case my description didn't make any sense. Is there a way to do this in plotly?