gpt4 book ai didi

r - 如何在 car::scatter3d 图中显示坐标网格

转载 作者:行者123 更新时间:2023-12-01 22:16:13 25 4
gpt4 key购买 nike

只需运行以下代码即可。我想显示坐标网格,但没有任何反应:

df_runtime <- data.frame(x = c(0L, 20L), 
y = c(0L, 10L),
z = c(0L, 50L), stringsAsFactors = FALSE)

car::scatter3d(x = df_runtime$x,
y = df_runtime$y,
z = df_runtime$z,
xlab = "x", ylab = "x", zlab = "z",
surface = FALSE, grid = TRUE)

从文档??car::scatter3d我意识到

plot grid lines on the regression surface(s) (TRUE or FALSE).

因此,grid 参数不是我想要的。 有没有办法获得坐标网格?对我来说,这作为眼睛的指南非常有用。

<小时/>

Carles 输入后编辑:

我想保留交互式图表 - 这就是我寻找 car::scatter3d 解决方案的原因。如果您不需要这个,scatterplot3dFactoClass 的组合非常好。以下以非交互方式工作:

scatterplot3d::scatterplot3d(
df_runtime$x,
df_runtime$y,
df_runtime$z,
color = "blue", pch = 19, # filled blue circles
# type = "h", # lines to the horizontal plane
main = "Title",
xlab = "x",
ylab = "y",
zlab = "z",
angle = 35,
grid = FALSE)
FactoClass::addgrids3d(df_runtime$x,
df_runtime$y,
df_runtime$z,
angle = 35,
grid = c("xy", "xz", "yz"))

最佳答案

如果您想要带有网格的交互式绘图,plotly 是另一种解决方案:

df_runtime <- data.frame(x = c(0L, 20L), 
y = c(0L, 10L),
z = c(0L, 50L), stringsAsFactors = FALSE)

plotly::plot_ly(df_runtime,
x = ~x,
y = ~y,
z = ~z,
type = 'scatter3d',
mode = 'markers')

Plotly Graph

关于r - 如何在 car::scatter3d 图中显示坐标网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51062306/

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