[英]What function can I use to limit my y-axis in a geom_bar plot?
我是 R 的新手並制作了一個非常簡單的直方圖,但是我的 y 軸范圍太大並且極大地限制了圖表的可見性。 我曾嘗試使用 ylim,但出現錯誤“discrete_scale 中的錯誤(c(“x”、“xmin”、“xmax”、“xend”)、“position_d”、:未使用的參數(ylim = c(0、75) )"
這是用於制作直方圖的代碼:
recipes %>%
mutate(ingredient = fct_infreq(ingredient)) %>%
ggplot(aes(x = ingredient)) +
geom_bar() +
scale_x_discrete(labels = NULL)
任何幫助和建議將不勝感激。
您似乎在 ylim 中有錯誤的語法。 嘗試:
recipes %>%
mutate(ingredient = fct_infreq(ingredient)) %>%
ggplot(aes(x = ingredient)) +
geom_bar() +
scale_x_discrete(labels = NULL) +
ylim(0, 75)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.