简体   繁体   English

从R中的矩阵创建3D表面图

[英]Creating a 3D Surface Plot from a matrix in R

I have been searching for this quite a while, but cannot find an answer to my problem or a minimum example. 我已经搜索了很长时间,但是找不到我的问题的答案或最低限度的示例。 I would like to make a 3D-plot of a matrix. 我想制作一个矩阵的3D图。

An extract of my data looks like this. 我的数据摘要如下所示。 There are the years, which I would like to use as X-Axis. 有些年份,我想用作X轴。 There is Y, which I would like to use as Y and I would like to plot z. 有Y,我想将其用作Y并绘制z。

Year       y     z
2000       1     467
2000       2   10678
2000       2      25
...

How can I make this a surface plot? 如何制作表面图?

Best 最好

Have you tried searching for how to plot a surface plot in R? 您是否尝试过搜索如何在R中绘制表面图? It turns out there's at least a persp function, a package called plot3D , wireframe in lattice and plotly . 事实证明,至少有一个persp函数,一个名为plot3D的包,处于plotlyplotly wireframe

For starters, try (from the plot3D package vignette) 对于初学者,请尝试(来自plot3D包插图)

library(plot3D)
example(persp3D)
example(surf3D)
example(slice3D)
example(scatter3D)
example(segments3D)
example(image2D)
example(image3D)
example(contour3D)
example(colkey)
example(jet.col)
example(perspbox)
example(mesh)
example(trans3D)
example(plot.plist)
example(ImageOcean)
example(Oxsat)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM