【发布时间】:2021-03-25 10:19:58
【问题描述】:
我想重新创建以下绘图,该绘图仅在行首和行尾的 y 和 x 轴上显示刻度线。 Picture of Plot。 到目前为止,我有以下代码:
elevation_plot <- StradeBianche%>%
ggplot(aes(x = `Accumulated Distance in Km`))+
geom_area(aes(y = elevation), fill = "grey")+
coord_cartesian(ylim = c(100,500))+
scale_y_continuous(expand = c(0,0), limits = c(0, 500), labels = label_number(suffix = " m"))+
scale_x_continuous(expand = c(0,0), breaks = seq(0, 180, 20), labels = label_number(suffix = ".0 km"))+
theme(panel.grid.minor = element_blank())+
theme(panel.grid.major = element_blank())+
theme(panel.background = element_rect(fill = "white"))+
theme(panel.border = element_blank())+
theme(axis.title = element_blank())+
theme(axis.ticks = element_blank())
结果是这样的:Picture of result。它非常接近,但蜱虫仍然不见了...... 我可以删除所有轴刻度或不删除。但是如果不删除沿轴的 x 和 y 值,我无法设法仅设置某些轴刻度。
非常感谢任何帮助!
【问题讨论】: