R ggplot2-将主题网格与轴刻度线对齐
我有一个ggplot2条形图,我更改了它的轴刻度。但是,配电盘格线正在添加我不想要的其他线。如何移除它们 我的问题:R ggplot2-将主题网格与轴刻度线对齐,r,ggplot2,bar-chart,panelgrid,R,Ggplot2,Bar Chart,Panelgrid,我有一个ggplot2条形图,我更改了它的轴刻度。但是,配电盘格线正在添加我不想要的其他线。如何移除它们 我的问题: 我只想要与x轴记号匹配的垂直网格线 由于有一个组和一个填充,位置dodge preserve无法正常工作 我的代码: ggplot(byyear, aes(x = year, y = count, group = venue, colour = venue, fill = type)) + geom_bar(stat = "identity", pos
ggplot(byyear, aes(x = year, y = count, group = venue, colour = venue, fill = type)) +
geom_bar(stat = "identity", position=position_dodge(preserve = "single")) +
# BORDER SO I CAN DISTINGUISH THEM
scale_colour_manual(name = "Venue", values = c("#FFFFFF", "#FFFFFF")) +
# MAKE ALL YEARS APPEAR
scale_y_continuous(labels = number_format(accuracy = 1)) +
scale_x_continuous(breaks = unique(byyear$year)) +
theme(legend.position="bottom",
axis.text.x = element_text(angle = 90, hjust = 1))
数据结构如下:
year,venue,type,count
2010,venue1,type1,163
2010,venue1,type2,18
2011,venue1,type1,16
...
我获得的绘图如下(我删除了绘图上的图例)
尝试将
主题(panel.grid.minor.x=element\u blank())添加到plotMagic!就这样。如果你加上它作为答案,我会接受的。