2011-04-04 29 views
1

我用qplot(log10(InDegree), username , data = df, colour = insamples)產生了這個結果。如何訂購通過qplot生成的點圖上的值?

有沒有辦法告訴qplot在y軸上從低到高的順序排列點?
enter image description here

+0

可能重複http://stackoverflow.com/questions/2427742/how-do-i-change -g -plot-in-ggplot2) – Chase 2011-04-04 22:49:37

+0

對我來說這似乎是一個不同的問題 – hadley 2011-04-05 02:00:27

回答

3

中的關鍵步驟是創建名稱的因子與所述值的順序碼。

require(datasets); require(ggplot2) 
precip2 = precip[-50]; precip2 = precip2[order(precip2)][1:20] 
states = names(precip2); states = factor(states, levels=states) 
qplot(precip2, states, data = d) 

enter image description here

的[我如何改變GGPLOT2柱狀圖在堆疊順序?](
+1

或者更容易使用'reorder' – hadley 2011-04-05 01:59:42

+0

你能更具體嗎?即顯示一些代碼。謝謝! – datayoda 2011-04-28 21:58:18