gpt4 book ai didi

将曲面图中的线条删除到 x、y 和 z 平面

转载 作者:行者123 更新时间:2023-12-05 04:03:51 24 4
gpt4 key购买 nike

当我在 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 平面的线(我的鼠标位于黑色箭头处,我想删除指向红色箭头的线)

enter image description here

我可以删除这些线吗?如果可以,如何删除?当我将鼠标悬停在图表上时,我不希望发生任何事情。

最佳答案

替换

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))

完成任务。

enter image description here

关于将曲面图中的线条删除到 x、y 和 z 平面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53207598/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com