我已经搜索了各种问题,虽然看到了类似的问题(一些确实很有帮助),但我似乎找不到答案。
我正在使用极地图,这些图默认添加一个额外的外部环,我不想要。我通过删除[panel.grid]并改用[geom.hline]来摆脱它。
这是我的问题:
如果我使用panel.ontop=FALSE,网格线将显示在图表下面,我失去了单位参考(我需要)(例如,你看不到对应于1的刻度在哪里)
如果我使用panel.ontop=TRUE,我就会失去网格线
我想要的是将网格线放在上面的图表(没有最外层的圆环)。在这里,你可以看到我的代码示例:
##Data
Main.Actions <- c("Financing","Anchoring regulations", "Awareness", "Sewage", "Enforcement", "Coordination")
count<-c(2, 2,4,2,3,3)
improve<-data.frame(Main.Actions, count, stringsAsFactors = FALSE)
## Plot
MA4<- ggplot(improve, aes(x = Main.Actions, y=count, fill=Main.Actions, width=1)) +
geom_hline(yintercept = seq(0, 4, by = 1), colour = "grey", size = 0.35) +
theme(
panel.grid.major.x=element_blank(),
panel.background = element_blank(),
panel.border = element_blank(),
panel.ontop = FALSE,
legend.position = "none",
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.y=element_blank(),
axis.text.x=element_blank(),
axis.ticks.y=element_blank())+
theme(plot.margin=unit(c(0,0,0,0),"cm"))+
geom_bar(stat="identity")+scale_fill_brewer(palette = "Blues") +
coord_polar()
MA4
我相信这是一件非常简单的事情,但是我已经花了三天时间,却做不好。
非常感谢任何帮助,
Ana