r - 如何制作分数条形图?
问题描述
当我这样做时:
ggplot(d, aes(x=variable, fill=value))+geom_bar(position = "fill")
我明白了
但我想要这样的东西,基本上这些值应该按分数着色。我怎样才能做到这一点?这个想法是基本上看到models, percentiles, and models:percentiles
每个的相对贡献R2, R5, and R10
。
数据框
structure(list(term = c("models", "percentiles", "models:percentiles",
"models", "percentiles", "models:percentiles", "models", "percentiles",
"models:percentiles"), variable = structure(c(1L, 1L, 1L, 2L,
2L, 2L, 3L, 3L, 3L), .Label = c("R2", "R5", "R10"), class = "factor"),
value = c(0.435697205847009, 0.533615307749147, 0.0306874864038442,
0.441369621882273, 0.520198994695284, 0.0384313834224421,
0.394491546635206, 0.579421546902868, 0.0260869064619254)), row.names = c(NA,
-9L), class = "data.frame")
解决方案
推荐阅读
- javascript - Ember 3 计算属性
- microsoft-graph-api - 权限不足,无法完成操作 - Graph API
- java - OOP 创建设计模式
- mongodb - 按具有不同值的相同键对 MongoDB 集合进行排序
- python - Python:通过从字符串读取将多个子元素附加到父元素
- php - Symfony 4 & Doctrine 2 在从集合中删除(第一个)项目后序列化导致转换为 JSON 对象而不是数组
- git - 如何恢复头部之前分支中的多个更改,但都来自同一个子分支?
- sqlite - SQLite Unix时间戳获取早于2天前的日期
- c# - 如何知道 Windows 应用商店应用程序已在 C# 或 VB 中终止?
- maven - Maven:根据星期几修改工件版本