使用颜色作为第三维度
我想要绘制 3 个维度,并且我希望第三个维度是颜色。
顺便说一句,这将在 R 中进行。例如,我的数据看起来像这样,
x = [1,2,3,4,1,5,6,3,4,7,8,9]
y = [45,32,67,32,32,47,89,91,10,12,43,27]
z = [1,2,3,4,5,6,7,8,9,10,11,12]
我正在尝试使用filled.contour,但它给了我一个错误,指出x和y必须按递增顺序。但我不太确定如何安排我的数据以使其真实。因为如果我按升序排列 x,那么 y 将不会按升序排列。
对我来说,执行非填充轮廓方法也是可行的,其中只是着色的数据点。我怎样才能在 R 中做到这一点。有什么建议的包吗?请使用具体的例子。谢谢!
I have 3 dimensions that I want to plot, and I want the third dimension to be color.
This will be in R by the way. For instance, my data looks like this
x = [1,2,3,4,1,5,6,3,4,7,8,9]
y = [45,32,67,32,32,47,89,91,10,12,43,27]
z = [1,2,3,4,5,6,7,8,9,10,11,12]
I am trying to use filled.contour, but it giving me an error saying x and y must be in increasing order. But I'm not really sure how to arrange my data such that that is true. Because if I arrange x in increasing order, then y will not be in increasing order.
It is also feasible for me to do a non-filled contour method where it is just data points that are colored. How can I do this in R. Any suggested packages? Please use specific examples. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想检查颜色,可以使用 z 值标记点:
另一种选择是使用 package:akima 对不规则(非)网格进行插值:
And if you want to check the coloring you can label the points with the z value:
Another option is to use package:akima which does interpolations on irregular (non)-grids: