您的位置:首页 > 其它

R语言第三章 统计绘图表示第三节

2016-05-08 16:02 295 查看
R语言

第三节

1、help(par)

有哪些颜色 colors()

> colors()

[1]"white" "aliceblue" "antiquewhite"

[4]"antiquewhite1" "antiquewhite2" "antiquewhite3"

[7]"antiquewhite4" "aquamarine" "aquamarine1"

[10]"aquamarine2" "aquamarine3" "aquamarine4"

[13]"azure" "azure1" "azure2"

[16]"azure3" "azure4" "beige"

[19]"bisque" "bisque1" "bisque2"

[22]"bisque3" "bisque4" "black"

[25]"blanchedalmond" "blue" "blue1"

[28]"blue2" "blue3" "blue4"

[31]"blueviolet" "brown" "brown1"

[34]"brown2" "brown3" "brown4"

[37]"burlywood" "burlywood1" "burlywood2"

[40]"burlywood3" "burlywood4" "cadetblue"

三维散点图

安装scatterplot3d包

* installing *source* package‘scatterplot3d’ ...

** package ‘scatterplot3d’ successfullyunpacked and MD5 sums checked

** R

** inst

** preparing package for lazy loading

** help

*** installing help indices

** building package indices

** installing vignettes

** testing if installed package can beloaded

* DONE (scatterplot3d)

The downloaded source packages are in

‘/tmp/Rtmpnxr8Ci/downloaded_packages’

2、调用三维作图



安装maps包

> install.packages("maps")

R脚本一如下:

library(maps)

map("state",interior=FALSE)



R脚本二如下:

library(maps)

map("state", boundary =FALSE,col="red",add=TRUE) #线宽变为红色



R脚本三如下:

library(maps)

map('world',fill=TRUE,col=heat.colors(10)) #地图



3、R实验:社交数据可视化

R脚本一如下:

library(maps)

library(geosphere)

map("state")



通过设置坐标范围使焦点集中在美国周边,并且设置一些有关颜色

R脚本二如下:

library(maps);

library(geosphere);

xlim <-c(-171.738281,-56.601563);

ylim <-c(12.039321,71.856229);

map("world",col="#f2f2f2",fill=TRUE,bg="white",lwd=0.05,xlim=xlim,ylim=ylim);

注意:以上我在脚本后面有时有加“;”有时没有加上。在正规语法情况下是要加上“;”。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: