我怎样才能重新创建这个 3d 直方图? [英] How can I recreate this 3d histogram?

查看:28
本文介绍了我怎样才能重新创建这个 3d 直方图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我说的是这张照片:

问题:

这是 R,不是 Matlab,对吗?在页面下方,它说它是用 R 制作的....

This is R, not Matlab right? Below the page it says it was made with R....

我该怎么做?我的意思是,我怎样才能用这个先进的绿色表面和这个网格创建这样一个 3d 散点图?我现在如何制作简单的散点图和 3d 散点图,但我怎样才能制作出如此高级的图片呢?这是哪个包?

How can I do this? I mean, how can I create such a 3d scatterplot with this advanced green surface and this grid? I now how to make simple scatterplots and also 3d scatterplots, but how can I create such an advanced picture? Which package is this?

我想将它包含在一张这张图片应该自动旋转的论文中.我知道如何将它包含在我的 tex 分布中,但因此我需要单个 png.所以例如我动画的 1000 张单张图片.但是我怎样才能用 R 得到那些呢?我需要旋转它,然后将每个小的旋转保存为图形文件.

I want to include it in a paper where this picture should rotate automatically. I know how to include this into my tex-distribution, but therefore I need single png. So e.g. 1000 single pictures which I animate. But how can I get those with R? I would need to rotate it and then save every single small rotation as a graphic file.

非常感谢您的帮助,我最大的问题是创建此图形(包?)以及如何使其旋转(r 代码?)

Thanks a lot for your help, my biggest problems are the creation of this graphic (packages?) and how to make it rotate (r code?)

推荐答案

  1. 要创建此图,您可以查看 persp 函数.您可以更改参数以旋转图形.这是一个演示:

  1. To create this figure, you might check out persp function. You can change the parameter to rotate the figure. Here's one demo:

require(grDevices) # for trans3d
x <- seq(-10, 10, length= 30)
y <- x
f <- function(x,y) { r <- sqrt(x^2+y^2); 10 * sin(r)/r }
z <- outer(x, y, f)
z[is.na(z)] <- 1
persp(x, y, z, theta = 90, phi = 30, expand = 0.5, col = "lightgreen")

当改变theta = 30时:

persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightgreen")

  1. 对于颜色,您可以键入 colors() 以查看可以使用的颜色.目前,我发现 lightgreen 可能是您想要的最接近的颜色.
  1. For color, you can type colors() to see what color you can use. Currently, I found lightgreen might be the closest color you want.

这篇关于我怎样才能重新创建这个 3d 直方图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆