2011-04-04 37 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