我正在嘗試對條形圖上的條進行重新排序,使它們從最大到最小,按 log(Max_N) 排序,而不是按字母順序排序。我嘗試過使用 forcats,但它會顯示一條錯誤訊息。到目前為止,這是我的代碼,出了什么問題?我正在嘗試自學如何使用ggplot,所以請指出我犯的任何錯誤,因為我是自學的!
library("ggplot2")
library (forcats)
test<-ggplot(all, aes(x=all$Species, y=log(all$Max_N 1)))
geom_bar(stat = "identity")
coord_flip()
test <- test labs(title = "",
subtitle = "",
caption = "",
y = "Log(MaxN)", x = "Species",
tag = "")
test %>%
mutate(name = fct_reorder(Species, log(Max_N 1)) %>%

轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/427667.html
