[英]How do I make the y-axis intersect the x-axis at 0 in ggplot2?
因此,當我制作情節時,我會看到y交叉x處於某個偏移處。 我使用以下方法生成此圖:
ggplot(data=d2,aes(y=log10(Nems+1),x=Time)) +
geom_point(size=3,shape=1) +
geom_line(data=d2,aes(x=time_model,y=log10(value),group=variable,linetype=variable)) +
ylim(0.001,2) + no_bg + draw_axis
我最終在Illustrator中手動移動y。 有沒有辦法在這里做到這一點?
嘗試將此添加到您的情節: + coord_cartesian(xlim = c(0, 90))
這應該將x軸限制為0到90。
您也可以執行+ xlim(0, 90)
,它具有類似的效果 - 但也會從數據集中刪除其邊界之外的任何數據。 如果你試圖放大應該使用整個數據集計算的geom的特征(例如,smooths),這可能會有問題,因為它只根據限制內的內容重新計算這些geom。 coord_cartesian()從完整數據集計算所有geom,然后將窗口限制為您指定的內容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.