当我用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平面上得到一条线(我的鼠标位于黑色箭头上,并且我想删除去往红色箭头的线)< / p>
我可以删除这些线吗?如果我将鼠标悬停在图表上,我什么也不想发生。
答案 0 :(得分:1)
替换
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))
完成工作。