全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1026 0
2019-11-13
用R语言的 alluvium包画桑基图时,想用target region数据来填充旁边的堆叠条颜色,代码报错,求帮助
是不是geom_stratum里的fill不能这么写,那应该怎么改正?

ggplot(as.data.frame(mydata_alluvia),aes(y=FDI.changes,axis1=Primary.sender,axis2=Target.state))+     geom_alluvium(aes(fill=Episodes),width=0)+   

geom_stratum(width=1/8,fill=factor(mydata$Target.region),color="grey")+   geom_text(stat="stratum",label.strata=TRUE,size=1.5,check_overlap = TRUE)+  

scale_x_discrete(limits=c("Primary sender","Target state"),expand=c(.05,.05))+   

scale_fill_brewer(type = "qual",palette="Set1")+     

ggtitle("Sanctions during 1970-2017")
Error: Aesthetics must be either length 1 or the same as the data (122): fill

二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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