全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
2924 2
2019-10-16
程序:
library(sp)
library(chinamap)
library(maps)
library(mapproj)
library(ggthemes)
library(ggplot2)
zhibiao=read.csv(file='https://github.com/ljtyduyu/DataWarehouse/blob/master/Rstudy/Province/chinaprovincecity.csv
',header = T)

cn<-get_map_china()
summary(cn)
ggplot()+geom_map(aes(x=long,y=lat,map_id=id),map=cn,data=cn,colour='black',fill='white')+
  coord_map()+
  geom_point(data=zhibiao,aes(x=jd,y=wd,size=zhibiao),colour='red',
             alpha=0.5)+
  theme_map()+
  theme(legend.position = c(.1, .25))
但总是出现这样的错误:
Warning: Ignoring unknown aesthetics: x, y
Don't know how to automatically pick scale for object of type data.frame. Defaulting to continuous.
错误: Aesthetics must be either length 1 or the same as the data (114): size


好像x、y读不出,求解决办法,谢谢

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2019-10-16 23:06:11
你试试看重写你画地图的方法,用geom_polygon看看,我用这个方法没什么问题。
复制代码
效果
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2019-10-17 08:40:42
ggplot() 中没有data实参
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群