我想用 Plotly 为时间序列绘制一个 3D 线图,并在每条线下填充。我在这里有一个示例代码。
library(plotly)
dens <- with(diamonds, tapply(price, INDEX = cut, density))
data <- data.frame(
x = unlist(lapply(dens, "[[", "x")),
y = unlist(lapply(dens, "[[", "y")),
cut = rep(names(dens), each = length(dens[[1]]$x)))
p <- plot_ly(data, x = ~cut, y = ~x, z = ~y, type = 'scatter3d', mode = 'lines', color = ~cut)
p
使用此代码,我可以生成此图
没有填充的 3d 线图
我已经尝试过surfaceaxis=0
,1 或 2,但他们产生了错误的填充物。
3D-Plotly 填充错误
我想要的是填充 x 轴和线图之间的区域。
有一个带有其他值的示例 3D 图。
作为示例 3D-Plot 在曲线下填充另一个值
有人可以建议一种方法吗?先感谢您。
编辑:它必须用包“plotly”创建