用 R 绘制 3D 图形 [英] Ploting 3D graphics with R

查看:37
本文介绍了用 R 绘制 3D 图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 3 个数据范围用于在 R 中绘图:

I have 3 data ranges using to plot in R:

x <- c(1,2,3,4,5)
y <- c(2,4,6,8,10)
z <- c(100,240,480,580,880)

如何使用 R 中的这些数据绘制 3D 图形(3d 散点图)?

How to plot a 3D graphic with those data in R (a 3d scatterplot) ?

推荐答案

只要稍微搜索一下,就有很多这样的例子.

There are many examples of this available with a bit of searching.

一些想法:

install.packages("scatterplot3d")
library(scatterplot3d) 


s3d <-scatterplot3d(x,y,z, pch=16, highlight.3d=TRUE,
  type="h", main="3D Scatterplot")

有时如果你能旋转它就很好:

Sometimes it is nice if you can rotate it:

install.packages("rgl")
library(rgl)

plot3d(x, y, z, col="red", size=3)

这篇关于用 R 绘制 3D 图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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