博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
基于RStudio 实现数据可视化之二
阅读量:5101 次
发布时间:2019-06-13

本文共 2658 字,大约阅读时间需要 8 分钟。

 

1、数据预览

注:(数据来源于国家统计局)

2、轮廓图

> par(mai=c(0.7,0.7,0.1,0.1),cex=0.8)> matplot(t(income[,2:9]),type="b",lty = 1:7,col=1:7,xlab = "消费项目",ylab = "支出金额",pch = 1,xaxt="n")> axis(side = 1,at=1:8,labels = c("食品","衣着","居住","家庭设备用品及服务","医疗保健","交通和通信","教育文化娱乐及服务","其他商品服务"),cex.axis=0.6)> legend(x="topright",legend = c("最低收入用户","低收入用户","中等偏下收入用户","中等收入用户","中等偏上收入用户","高收入用户","最高收入用户"),lty=1:7,col=1:7,text.width=1,cex=0.7)

3、雷达图

> radarchart(income[,2:9],axistype = 0,seg = 4,maxmin = FALSE,vlabels = names(income[,2:9]),pcol = 1:7,plwd = 2.0)> legend(x="topleft",legend = c("最低收入用户","低收入用户","中等偏下收入用户","中等收入用户","中等偏上收入用户","高收入用户","最高收入用户"),lty=1:7,col=1:7,text.width=0.6,lwd=0.8,cex=0.8)

 

4、星图

4.1、不同收入等级的星图

stars(income_matrix,key.loc=c(7,2,5),cex=0.8)

4.2、不同消费项目的星图

> stars(t(income_matrix),full = FALSE,draw.segments = TRUE, key.loc=c(6,2,5),cex=0.8)

  

5、脸谱图

> install.packages("aplpack")trying URL 'https://dirichlet.mat.puc.cl/bin/windows/contrib/3.5/aplpack_1.3.2.zip'Content type 'application/zip' length 3608846 bytes (3.4 MB)downloaded 3.4 MBpackage ‘aplpack’ successfully unpacked and MD5 sums checkedThe downloaded binary packages are in	C:\Users\AppData\Local\Temp\Rtmp4aNIAV\downloaded_packages> library(aplpack)载入需要的程辑包:tcltk> library(aplpack)> faces(income_matrix,nrow.plot = 4,ncol.plot = 2,face.type = 0)effect of variables: modified item       Var                   "height of face   " "食品"                "width of face    " "衣着"                "structure of face" "居住"                "height of mouth  " "家庭设备.用品及服务" "width of mouth   " "医疗保健"            "smiling          " "交通和.通信"         "height of eyes   " "教育文化.娱乐服务"   "width of eyes    " "其他商品.和服务"     "height of hair   " "食品"                "width of hair   "  "衣着"                "style of hair   "  "居住"                "height of nose  "  "家庭设备.用品及服务" "width of nose   "  "医疗保健"            "width of ear    "  "交通和.通信"         "height of ear   "  "教育文化.娱乐服务"

  

不同消费项目的脸谱图

> faces(t(income_matrix),nrow.plot = 4,ncol.plot = 2,face.type = 0)effect of variables: modified item       Var                   "height of face   " "最低输入户(10%)"   "width of face    " "低收入户(10%)"     "structure of face" "中等偏下户(20%)"   "height of mouth  " "中等收入用户(20%)" "width of mouth   " "中等偏上户(20%)"   "smiling          " "高收入户(10%)"     "height of eyes   " "最高收入户(10%)"   "width of eyes    " "最低输入户(10%)"   "height of hair   " "低收入户(10%)"     "width of hair   "  "中等偏下户(20%)"   "style of hair   "  "中等收入用户(20%)" "height of nose  "  "中等偏上户(20%)"   "width of nose   "  "高收入户(10%)"     "width of ear    "  "最高收入户(10%)"   "height of ear   "  "最低输入户(10%)"

  

 

转载于:https://www.cnblogs.com/RHadoop-Hive/p/10156361.html

你可能感兴趣的文章
LeetCode Factorial Trailing Zeroes (阶乘后缀零)
查看>>
hdu 5402 Travelling Salesman Problem (技巧,未写完)
查看>>
[AIR] 获取U盘,打开U盘
查看>>
HtmlUnitDriver 网页内容动态抓取
查看>>
ad logon hour
查看>>
获得进程可执行文件的路径: GetModuleFileNameEx, GetProcessImageFileName, QueryFullProcessImageName...
查看>>
证件照(1寸2寸)拍摄处理知识汇总
查看>>
罗马数字与阿拉伯数字转换
查看>>
Eclipse 反编译之 JadClipse
查看>>
asp.net 获取IP地理位置的几个主要接口
查看>>
Python入门-函数
查看>>
[HDU5727]Necklace(二分图最大匹配,枚举)
查看>>
距离公式汇总以及Python实现
查看>>
设计模式之装饰者模式
查看>>
一道不知道哪里来的容斥题
查看>>
Blender Python UV 学习
查看>>
window添加右键菜单
查看>>
入手腾龙SP AF90mm MACRO
查看>>
python学习4 常用内置模块
查看>>
Window7上搭建symfony开发环境(PEAR)
查看>>