How can I recreate this 3d histogram?

2019-08-15 02:39发布

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条回答
来,给爷笑一个
2楼-- · 2019-08-15 03:20
  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")
    

enter image description here

When change theta = 30:

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

enter image description here

  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.
查看更多
登录 后发表回答