R:绘制大于原始数据的轴显示值 [英] R: Plot Axis Display Values Larger than the Original Data
问题描述
我使用的是 R 编程语言.我正在这里学习有关数据可视化的教程:
如此处所见,此 3D 图中有一个点为y = 97".我不确定这怎么可能,因为原始数据框d"中的任何值都没有.在任何地方都接近 97.我通过查看原始数据框d"中每个变量的单独分布来确定这一点:
#plot 个体密度情节(密度(d $ a),主要=密度图",col=红色")线(密度(d $ b),col =蓝色")线(密度(d $ c),col =绿色")图例(左上角",c(a",b",c"),text.col=c(红色"、蓝色"、绿色"))
如这里所见,原始数据框d"中的任何变量(a、b、c)都没有有任何接近 97 的值.
因此,我的问题是:谁能解释一下点 (x = 0 , y = 97, z =25.326) 怎么可能出现在这个 3D 图中?
谢谢
我不确定这是否能解决问题 - 但使用与之前的 stackoverflow 帖子相同的逻辑:
现在,在这个可视化图中看到的所有值似乎都包含在原始数据框中.
但是,我仍然不确定这两个图之间的基本(和数学)区别是什么:
我很想知道别人怎么说.
谢谢
I am using the R programming language. I am following a tutorial on data visualization over here: https://plotly.com/r/3d-surface-plots/
I created my own data and made a 3D plot:
library(plotly)
set.seed(123)
#generate data
a = rnorm(100,10,10)
b = rnorm(100,5,5)
c = rnorm(100,5,10)
d = data.frame(a,b,c)
#3d plot
fig <- plot_ly(z = ~as.matrix(d))
fig <- fig %>% add_surface()
#view plot
fig
As seen here, there is a point on this 3D plot where "y = 97". I am not sure how this is possible, seeing how none of the values within the original data frame "d" are anywhere close to 97. I made sure of this by looking at the individual distributions of each variable in the original data frame "d":
#plot individual densities
plot(density(d$a), main = "density plots", col = "red")
lines(density(d$b), col = "blue")
lines(density(d$c), col = "green")
legend( "topleft", c("a", "b", "c"),
text.col=c("red", "blue", "green") )
As seen here, none of the variables (a,b,c) from the original data frame "d" have any values that are close to 97.
Thus, my question: can someone please explain how is it possible that the point (x = 0 , y = 97, z =25.326) appears on this 3D plot?
Thanks
I am not sure if this will resolve the problem - but using the same logic from this previous stackoverflow post: 3D Surface with Plot_ly in r, with x,y,z coordinates
library(plotly)
set.seed(123)
#generate data
a = rnorm(100,10,10)
b = rnorm(100,5,5)
c = rnorm(100,5,10)
d = data.frame(a,b,c)
data = d
plot_ly() %>%
add_trace(data = data, x=data$a, y=data$b, z=data$c, type="mesh3d" )
Now, it appears that all values seen in this visual plot are contained in the original data frame.
However, I am still not sure what is the fundamental (and mathematical) difference between both of these plots:
I am curious to see what others have to say.
Thanks
这篇关于R:绘制大于原始数据的轴显示值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!