将曲面图中的线条删除到 x、y 和 z 平面
Remove lines in surface plot in plotly to x-, y-, and z-plane
当我在 R
中使用 plotly
绘制以下图时
library(plotly)
library(mvtnorm)
y <- x <- seq(-10, 10, length = 80)
sig <- diag(7^2, 2)
cn <- list(c(0.0, "rgb(192,192,192)"), list(1, "rgb(0, 0, 0)"))
con <- list(
x = list(highlight = FALSE),
y = list(highlight = FALSE),
z = list(highlight = FALSE))
dens <- matrix(dmvnorm(expand.grid(x, y), sigma = sig), ncol = length(x))
plot_ly(showscale = FALSE, color = I("black")) %>%
add_surface(z = dens, x = x, y = y, colorscale = cn, hoverinfo = "none",
opacity = .9, contours = con) %>%
layout(
scene = list(
xaxis=list(title = "x1", range = c(-10, 10)),
yaxis=list(title = "x2", range = c(-10, 10)),
zaxis=list(title = "density")),
plot_bgcolor = 'rgb(0, 0, 0, 0)', paper_bgcolor = 'rgba(0,0,0,0)') %>%
config(displayModeBar = FALSE)
然后,当我将鼠标悬停在一个点上时,我仍然会得到一条指向 x、y 和 z 平面的线(我的鼠标位于黑色箭头上,我想删除指向红色箭头的线)
我可以删除这些行吗?如果可以,如何删除? 我不希望鼠标悬停在图表上时发生任何事情。
正在替换
scene = list(
xaxis = list(title = "x1", range = c(-10, 10)),
yaxis = list(title = "x2", range = c(-10, 10)),
zaxis = list(title = "density"))
来自
scene = list(
xaxis = list(title = "x1", range = c(-10, 10), showspikes = FALSE),
yaxis = list(title = "x2", range = c(-10, 10), showspikes = FALSE),
zaxis = list(title = "density", showspikes = FALSE))
完成任务。
当我在 R
中使用plotly
绘制以下图时
library(plotly)
library(mvtnorm)
y <- x <- seq(-10, 10, length = 80)
sig <- diag(7^2, 2)
cn <- list(c(0.0, "rgb(192,192,192)"), list(1, "rgb(0, 0, 0)"))
con <- list(
x = list(highlight = FALSE),
y = list(highlight = FALSE),
z = list(highlight = FALSE))
dens <- matrix(dmvnorm(expand.grid(x, y), sigma = sig), ncol = length(x))
plot_ly(showscale = FALSE, color = I("black")) %>%
add_surface(z = dens, x = x, y = y, colorscale = cn, hoverinfo = "none",
opacity = .9, contours = con) %>%
layout(
scene = list(
xaxis=list(title = "x1", range = c(-10, 10)),
yaxis=list(title = "x2", range = c(-10, 10)),
zaxis=list(title = "density")),
plot_bgcolor = 'rgb(0, 0, 0, 0)', paper_bgcolor = 'rgba(0,0,0,0)') %>%
config(displayModeBar = FALSE)
然后,当我将鼠标悬停在一个点上时,我仍然会得到一条指向 x、y 和 z 平面的线(我的鼠标位于黑色箭头上,我想删除指向红色箭头的线)
我可以删除这些行吗?如果可以,如何删除? 我不希望鼠标悬停在图表上时发生任何事情。
正在替换
scene = list(
xaxis = list(title = "x1", range = c(-10, 10)),
yaxis = list(title = "x2", range = c(-10, 10)),
zaxis = list(title = "density"))
来自
scene = list(
xaxis = list(title = "x1", range = c(-10, 10), showspikes = FALSE),
yaxis = list(title = "x2", range = c(-10, 10), showspikes = FALSE),
zaxis = list(title = "density", showspikes = FALSE))
完成任务。