我在ggplot中制作了一个图表,并将我的x轴标签旋转了80度。但是,这导致我的x轴标签不再与我的x轴刻度线对齐(标签距离刻度线的右侧有点太远)。谁能帮我把x轴标签移到左边?我尝试了hjust和vjust,但两者似乎都让我的轴标签上下移动而不是左右移动......
我的数据框的头部(称为数据)如下所示:
Date Well Elev
1 2002-05-23 MW-3 929.04
2 2002-05-29 MW-3 929.39
3 2002-05-31 MW-3 929.37
4 2002-06-05 MW-3 929.36
5 2002-06-12 MW-3 NA
6 2002-06-13 MW-3 929.47
7 2002-06-19 MW-3 929.42
8 2002-06-26 MW-3 930.02
9 2002-07-05 MW-3 930.00
我的代码看起来像这样:
ggplot(data= Data, aes(x = Date, y = Elev, group = Well, colour = Well)) +
geom_line(size = 0.75) +
xlab("") + ylab("Elevation (ft.)") +
scale_color_brewer(palette = "Spectral") +
scale_x_date(breaks = date_breaks("1 year"),
date_labels = ("%b %Y")) +
theme(axis.text.x = element_text(angle = 80, hjust = 1),
panel.grid.major.x = element_blank(),
panel.grid.major.y = element_line( size=.1, color="gray"),
panel.grid.minor = element_blank(),
axis.line.x = element_line(color = "black"),
axis.line.y = element_line(color = "black"),
panel.background = element_rect(fill = "white"))