cbw1243 发表于 2016-7-25 11:04 
所有aes里面用到的variable都要在heat里面
已经将排序加到heat里面,比如下面的数据我需要按照order列在Y轴上做降序排列需要怎么写呢?
用下面的代码画图还是变成按sec_desc排。
ggplot(heat,aes(as.factor(date),sec_desc,fill=degree,order=order))+geom_raster(na.rm = TRUE)
> heat
Source: local data frame [613 x 4]
Groups: date [?]
date sec_desc degree order
<date> <chr> <dbl> <int>
1 2016-07-25 特斯拉指数 122.22222 1
2 2016-07-25 次新股指数 116.21622 2
3 2016-07-25 智能电视指数 110.00000 3
4 2016-07-25 OLED指数 90.90909 4
5 2016-07-25 量子通信指数 85.71429 5
6 2016-07-25 锂电池指数 81.63265 6
7 2016-07-25 石墨烯指数 77.27273 7
8 2016-07-25 虚拟现实指数 74.60317 8
9 2016-07-25 网红经济指数 73.68421 9
10 2016-07-25 移动转售指数 66.66667 10
# ... with 603 more rows
>