真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

R語言數(shù)據(jù)可視化實例分析

今天小編給大家分享一下R語言數(shù)據(jù)可視化實例分析的相關(guān)知識點,內(nèi)容詳細,邏輯清晰,相信大部分人都還太了解這方面的知識,所以分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后有所收獲,下面我們一起來了解一下吧。

創(chuàng)新互聯(lián)專注于企業(yè)營銷型網(wǎng)站、網(wǎng)站重做改版、蓮都網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、成都h5網(wǎng)站建設(shè)、成都做商城網(wǎng)站、集團公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為蓮都等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

library("plyr")

library("dplyr")

library("ggplot2")

library("ggmap")

library("maptools")

library("maps")

library("REmap")

library("Cairo")

library("baidumap")

library(showtext)

################中國地圖######################

china_map<-readShapePoly("c:/rstudy/bou2_4p.shp")

x1 <- china_map@data          

xs1 <- data.frame(x1,id=seq(0:924)-1)  

china_map1 <- fortify(china_map) 

china_map_data <- join(china_map1, xs1, type = "full") 

mydata1 <- read.csv("c:/rstudy/geshengzhibiao.csv")

china_data <- join(china_map_data, mydata1, type="full") 

####################放射路徑氣泡圖#####################

city_list<-c("西安","西寧","鄭州","重慶","成都","石家莊","蘭州","濟南","大同","咸陽","包頭")

#address<-get_geo_position(city_list)

address<-getCoordinate(city_list, formatted = T)

address<-data.frame(address,city=row.names(address),stringsAsFactors = FALSE)

del<-getCoordinate("長沙", formatted = T)

del<-as.character(del)

lonx<-as.numeric(rep(del[1],11))

laty<-as.numeric(rep(del[2],11))

address<-data.frame(address,lonx,laty)

address$lonx<-as.numeric(address$lonx)

address$laty<-as.numeric(address$laty)

names(address)[1:2]<-c("lon","lat")

address$Num<-round(runif(11,50,100),2)

#----------------------------------------------------------------------------------------------------

font.add("myfont", "msyhl.ttc")

CairoPNG(file="C:/Users/Administrator/Desktop/航線圖1.png",width=1000,height=670)

showtext.begin()

ggplot()+

geom_polygon(data=china_data,aes(x=long,y=lat,group=group),fill="white",size=0.2,colour="#D9D9D9")+

geom_segment(data=address,aes(x=lon,y=lat,xend=lonx,yend=laty),size=0.3,colour="#FF6833")+

geom_point(data=address,aes(x=lon,y=lat,size=Num),shape=21,fill="#ED7D31",col="#E02939",alpha=.6)+

geom_point(data=NULL,aes(x=112.97935,y=28.21347),shape=21,size=8,fill=NA,col="steelblue")+

guides(fill=FALSE)+

coord_map("polyconic")+

scale_size_area(max_size=8)+ 

     theme(

          plot.background=element_rect(fill="#D0DEDE", color=NA),

          panel.spacing = unit(0,"lines"), 

          plot.margin=unit(rep(0.2,4),"cm"),

          panel.grid = element_blank(),

          panel.background = element_blank(),

          axis.text = element_blank(),

          axis.ticks = element_blank(),

          axis.title = element_blank(),

          #legend.position=c(0.8,0.3),

          legend.position="none"

          )

showtext.end()  

dev.off()

R語言數(shù)據(jù)可視化實例分析

#######################遷徙路徑氣泡圖##################################

city_list<-c("???,"廣州","長沙","武漢","鄭州","石家莊","北京","沈陽","長春","哈爾濱")

addA<-getCoordinate(city_list, formatted = T)

addA<-data.frame(addA,city=row.names(addA),stringsAsFactors = FALSE)

data1<-addA[-1,]

names(data1)[1:2]<-c("lonx","latx")

data2<-addA[-length(row.names(addA)),]

names(data2)[1:2]<-c("lony","laty")

addB<-cbind(data2,data1)[,-3]

addA$Num<-round(runif(10,50,100),2)

names(addA)[1:2]<-c("lon","lat")

#-------------------------------------------------------------------------------------------------------

font.add("myfont", "msyhl.ttc")

CairoPNG(file="C:/Users/Administrator/Desktop/航線圖2.png",width=1000,height=670)

showtext.begin()

ggplot()+

geom_polygon(data=china_data,aes(x=long,y=lat,group=group),fill="white",size=0.2,colour="#D9D9D9")+

geom_segment(data=addB,aes(x=lonx,y=latx,xend=lony,yend=laty),size=0.3,colour="#FF6833")+

geom_point(data=addA,aes(x=lon,y=lat,size=Num),shape=21,fill="#ED7D31",col="#E02939",alpha=.6)+

guides(fill=FALSE)+

coord_map("polyconic")+

scale_size_area(max_size=8)+ 

     theme(

          plot.background=element_rect(fill="#D0DEDE", color=NA),

          panel.spacing = unit(0,"lines"), 

          plot.margin=unit(rep(0.2,4),"cm"),

          panel.grid = element_blank(),

          panel.background = element_blank(),

          axis.text = element_blank(),

          axis.ticks = element_blank(),

          axis.title = element_blank(),

          #legend.position=c(0.8,0.3),

          legend.position="none"

          )

showtext.end()  

dev.off()

R語言數(shù)據(jù)可視化實例分析

########################閉環(huán)路徑氣泡圖################################

city_list3<-c("蘭州","成都","重慶","貴陽","昆明","南寧","???,"廣州","福州","上海","青島","石家莊","呼和浩特","銀川")

addC<-getCoordinate(city_list3, formatted = T)

addC<-data.frame(addC,city=row.names(addC),stringsAsFactors = FALSE)

names(addC)[1:2]<-c("lon","lat")

datac1<-addC[2:14,]

datac2<-addC[1,]

addCC<-rbind(datac1,datac2)

adddata<-cbind(addC,addCC)

names(adddata)<-c("lonx","latx","city","lony","laty","city")

adddata<-adddata[,-3]

addC$Num<-round(runif(14,50,100),2)

#-------------------------------------------------------------------------------------------------------------

CairoPNG(file="C:/Users/Administrator/Desktop/航線圖3.png",width=1000,height=670)

showtext.begin()

ggplot()+

geom_polygon(data=china_data,aes(x=long,y=lat,group=group),fill="white",size=0.2,colour="#D9D9D9")+

geom_segment(data=adddata,aes(x=lonx,y=latx,xend=lony,yend=laty),size=0.3,colour="#FF6833")+

geom_point(data=addC,aes(x=lon,y=lat,size=Num),shape=21,fill="#ED7D31",col="#E02939",alpha=.6)+

guides(fill=FALSE)+

coord_map("polyconic")+

scale_size_area(max_size=8)+ 

     theme(

          plot.background=element_rect(fill="#D0DEDE", color=NA),

          panel.spacing = unit(0,"lines"), 

          plot.margin=unit(rep(0.2,4),"cm"),

          panel.grid = element_blank(),

          panel.background = element_blank(),

          axis.text = element_blank(),

          axis.ticks = element_blank(),

          axis.title = element_blank(),

          #legend.position=c(0.8,0.3),

          legend.position="none"

          )

showtext.end()  

dev.off()

R語言數(shù)據(jù)可視化實例分析

#-------------------------------------------方形氣泡圖---------------------------------------------------

CairoPNG(file="C:/Users/Administrator/Desktop/航線圖4.png",width=1000,height=670)

showtext.begin()

ggplot()+

geom_polygon(data=china_data,aes(x=long,y=lat,group=group),fill="white",size=0.2,colour="#D9D9D9")+

geom_point(data=address,aes(x=lon,y=lat,size=Num,fill=Num),shape=22,col="#E02939",alpha=.6)+

guides(fill=FALSE)+

scale_fill_gradient2(low="#8E0F2E", mid="#BFBEBE", high="#0E4E75", midpoint=median(na.omit(address$Num)))+

coord_map("polyconic")+

scale_size_area(max_size=8)+ 

     theme(

          plot.background=element_rect(fill="#D0DEDE", color=NA),

          panel.spacing = unit(0,"lines"), 

          plot.margin=unit(rep(0.2,4),"cm"),

          panel.grid = element_blank(),

          panel.background = element_blank(),

          axis.text = element_blank(),

          axis.ticks = element_blank(),

          axis.title = element_blank(),

          #legend.position=c(0.8,0.3),

          legend.position="none"

          )

showtext.end()  

dev.off()

R語言數(shù)據(jù)可視化實例分析

#-----------------------------------------------菱形氣泡圖-----------------------------------------------------

CairoPNG(file="C:/Users/Administrator/Desktop/航線圖5.png",width=1000,height=670)

showtext.begin()

ggplot()+

geom_polygon(data=china_data,aes(x=long,y=lat,group=group),fill="white",size=0.2,colour="#D9D9D9")+

geom_point(data=address,aes(x=lon,y=lat,size=Num,fill=Num),shape=23,col="#E02939",alpha=.6)+

guides(fill=FALSE)+

scale_fill_gradient2(low="#8E0F2E", mid="#BFBEBE", high="#0E4E75", midpoint=median(na.omit(address$Num)))+

coord_map("polyconic")+

scale_size_area(max_size=8)+ 

     theme(

          plot.background=element_rect(fill="#D0DEDE", color=NA),

          panel.spacing = unit(0,"lines"), 

          plot.margin=unit(rep(0.2,4),"cm"),

          panel.grid = element_blank(),

          panel.background = element_blank(),

          axis.text = element_blank(),

          axis.ticks = element_blank(),

          axis.title = element_blank(),

          #legend.position=c(0.8,0.3),

          legend.position="none"

          )

showtext.end()  

dev.off()

R語言數(shù)據(jù)可視化實例分析

以上所有圖表的指標數(shù)據(jù)均為隨機數(shù)虛構(gòu),圖表的圖形代碼使用showtext和Cario進行高清渲染并自動輸出,除了需加載的地圖素材之外,其他代碼均可一次性放在控制臺流暢運行。

以上就是“R語言數(shù)據(jù)可視化實例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家閱讀完這篇文章都有很大的收獲,小編每天都會為大家更新不同的知識,如果還想學習更多的知識,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。


當前名稱:R語言數(shù)據(jù)可視化實例分析
分享路徑:http://weahome.cn/article/gohijg.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部