基於RStudio 實現數據可視化之二

 

一、數據預覽windows

注:(數據來源於國家統計局)app

二、輪廓圖ide

> 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)

三、雷達圖blog

> 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)

 

四、星圖ip

4.一、不一樣收入等級的星圖it

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

4.二、不一樣消費項目的星圖io

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

  

五、臉譜圖class

> 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 MB

package ‘aplpack’ successfully unpacked and MD5 sums checked

The 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   "  "教育文化.娛樂服務"  

  

不一樣消費項目的臉譜圖im

> 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%)"  
相關文章
相關標籤/搜索