R语言在可视化方面的地位是毋庸置疑的,但是呢相对于MatalabR语言在三维图形的展示上存在一定的劣势。当然,作为大众的免费软件,指定不服,很多人为此也基于R语言开发了一些相应的三维图的绘制包,像rgl,gg3D,plot3D,scatterplot3d等,我们今天就介绍一下其中的scatterp
library(ggplot2) # Creating a Scatter Plot ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() # Creating a Line Graph ggplot(pressure, aes(x = temperature, y = pressure)) + geom_line() + geom_point() # Creating a Box Plot ggplot(ToothGrowth, aes(x = supp, y = len)) +...
library("scatterplot3d", lib.loc="D:/R/R-3.6.0/library") attach(mtcars) scatterplot3d(x=wt,y=disp,z=mpg, pch=16,highlight.3d = T, type='h') detach(mtcars) #1.2.1 三维散点图添加回归面 p245 attach(mtcars) s3d<-scatterplot3d(wt,disp,mpg, pch=16,highlight.3d = T, type='...
前面提到的图形都是二维的,如果想对 3 个数值型变量的关系进行可视化,可以使用scatterplot3d包的 scatterplot3d( )函数,使用前请先安装该包。 函数scatterplot3d( ) 提供的参数选项包括设置图形符号、突出显示、角度、颜色、线条、坐标轴和网格线等。下面以 datasets 包里的数据集 trees 为例说明此函数的用法。该...
plot3d(): http://www.rforscience.com/rpackages/visualisation/oceanview/ [3] rgl包: https://www.rdocumentation.org/packages/rgl/versions/0.100.54 [4] Animated 3d chart with R.: https://www.r-graph-gallery.com/3-r-animated-cube.html 本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
R中scatterplot3d包的scatterplot3d()函数、rgl包的plot3d()[2]函数、plot3D包的scatter3D()函数等都可以绘制三维散点图。 下面将从两个包的两个函数(scatter3D(),plot3d())入手,一步步带你完成三维散点图的绘制。本文内容丰富,希望大家都能学到自己想要的内容,学习不易,欢迎反馈建议。
library(scatterplot3d) data(trees) scatterplot3d(trees, type = "h", highlight.3d = TRUE, angle = 55, pch = 16) 1. 2. 3. 上面函数 scatterplot3d( )中的参数 type 用于设置绘图的类型,默认为“p”(点),这里设为“h”,显示垂线段。参数 angle 用于设置 x 轴和 y 轴的角度。需要注意的是...
Change the global appearance of the graph The arguments below can be used: grid: a logical value. If TRUE, a grid is drawn on the plot. box: a logical value. If TRUE, a box is drawn around the plot Remove the box around the plot scatterplot3d(iris[,1:3], pch = 16, color = ...
plot3d():http://www.rforscience.com/rpackages/visualisation/oceanview/ [3] rgl包:https://www.rdocumentation.org/packages/rgl/versions/0.100.54 [4] Animated 3d chart with R.:https://www.r-graph-gallery.com/3-r-animated-cube.html
plot.new(): 新建一个空白的窗口。 curve()函数: 这个函数用来画曲线,例子如下: f <- function(x){return(1-exp(-x))} curve(f,0,2) 表示画一条f的曲线,曲线的定义域是0到2. 低级画图函数: stats::density(algae$mxPH,na.rm=T) 核密度函数,作用是假设数据服从某个密度分布,此函数结合lines()函...