-2
我重新排序GGPLOT2我的價值觀後:爲了填補GGPLOT2重新排序X
KR %>% ggplot(aes(x= reorder(categories, -n), n, fill = categories, order =
categories)) + geom_bar(stat = "identity") + (axis.title.x=element_blank(),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
現在我想的是fill
值具有相同的順序在x軸上的值。我用order
嘗試過,但它不起作用。
str(KR)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 20 obs. of 2 variables:
$ categories: chr "Food" "Nightlife" "Bars" "American (Traditional)" ...
$ n : int 8576 6334 6067 5312 5250 5229 5220 4118 3868 3673 ...
歡迎棧溢出請重建您的示例以可重現的方式嘗試使用內置數據集請參閱此指南:http://stackoverflow.com/help/mcve和https://stackoverflow.com/questions/5963269/如何對做 - 一個偉大-R-重複性,例如 –