我怎样才能重新创建此3D柱状图? [英] How can I recreate this 3d histogram?

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

问题描述

我说的是这样的画面:

问题:

这是R,Matlab的不正确的?下面它说,它是制作与R上的网页...

我怎样才能做到这一点?我的意思是,我怎么能创造出这样一个三维散点图这一先进的绿色表面与该网格?我现在该怎么做简单的散点图,也是3D散点图,但我怎么能创造出这样一个先进的图像?哪个方案是什么?

我想包括它在一份文件中,其中这张照片会自动旋转。我知道如何将之纳入到我的TEX-分布,但因此我需要一个PNG。因此,如1000单的照片,我的动画。但我怎么能得到那些有R?我需要旋转它,然后每一个小型旋转保存为图形文件。

非常感谢你的帮助,我最大的问题是创建这个图形(包?),以及如何使它旋转(R code?)

解决方案
  1. 要创建这个数字,你可以看看 persp 功能。你可以改变旋转图中的参数。这里有一个演示:

     要求(grDevices)#为trans3d
    X  -  LT;  - 序列(-10,10,长度= 30)
    Y'LT;  -  X
    F<  - 函数(X,Y){为r  - 开方(X ^ 2 + Y ^ 2); 10 *罪(R)/ R}
    z,其中, - 外(X,Y,F)
    Z [is.na(Z)]<  -  1
    persp(X,Y,Z,THETA = 90,披= 30,扩大= 0.5,列=浅绿)
     

在变化 THETA = 30

  persp(X,Y,Z,THETA = 30,披= 30,扩大= 0.5,列=浅绿)
 

  1. 对于颜色,你可以键入颜色()来看看有什么颜色,你可以使用。目前,我发现浅绿可能是你想要的最接近的颜色。

I am talking about this picture:

Questions:

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

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?

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.

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. 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")
    

When change theta = 30:

persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "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天全站免登陆