当我使用geom_tile()与ggplot2和离散缩放标签在x轴按升序排列,在y轴降序排列:
#some sample data
a <- runif(400)
a <- matrix(a, ncol=20)
colnames(a) <- letters[seq( from = 1, to = 20 )]
rownames(a) <- letters[seq( from = 1, to = 20 )]
a <- melt(a)
Run Code Online (Sandbox Code Playgroud)
当我绘制数据帧时,a这就出现了:
ggplot(a, aes(X1, X2, fill = value)) + geom_tile() +
scale_fill_gradient(low = "white", high = "black", breaks=seq(from=0, to=1, by=.1), name="value") +
opts(axis.text.x=theme_text(angle=-90, hjust=0)) +
scale_x_discrete(name="") + scale_y_discrete(name="")
Run Code Online (Sandbox Code Playgroud)
并且对于x和y标记的coords不同:

我想让标签从上到下,从左到右排序.有一个快速的方法来做到这一点?