r - ggplot2 - 按区域大小范围排序区域图
问题描述
我有一个关于按大小订购区域图的问题。我想从大尺寸到小尺寸排序。如,
这是我的代码
library(ggplot2)
ggplot(data,aes(x = DT, y = value,group=DMG,color=DMG)) +
geom_smooth(method = "lm",
se = FALSE,
formula = 'y ~ x',
span = 0.8) +
stat_smooth(se=FALSE, geom="area",
method = "lm",
position = position_stack(reverse = T),
span = 0.75,aes(fill=DMG))
使用position_stack(reverse = T)
,只有一个区域是错误的排序(粉红色区域)
这是一个输入数据 data.csv
#str(dmg_all)
'data.frame': 1625 obs. of 3 variables:
$ DT : num 0 0.19 0.284 0.362 0.397 ...
$ DMG : Factor w/ 5 levels "AGR_DMG","LB_DMG",..: 1 1 1 1 1 1 1 1 1 1 ...
$ value: num 0 0.0282 0.0407 0.0503 0.0533 ...
#dmg_all$DMG
Levels: AGR_DMG LB_DMG MORT_DMG ED_DMG HPP_DMG
你能指导我做什么吗?太感谢了。
解决方案
推荐阅读
- django - 如何使用重定向传递参数?
- c++ - 使用 crosstool-ng 编译 gcc 时出错
- regex - 正则表达式必须是 6 位数字,最后 2 位必须是 81
- tcp - 来自wireshark pcap文件的数据包丢失
- javascript - 使用 JavaScript 在移动设备上排除功能
- html - 空表单元格比非空表单元格高
- c# - 如果文件在保存到 .csv 时已经存在,则防止应用程序崩溃
- javascript - 如何在 Vue.js 中将驼峰大小写转换为正确大小写?
- python - linux上的python无法理解sql时间戳
- python - 评估函数如何在 keras 中工作