r - 使用字符数据的百分比堆积条形图
问题描述
假设我有这些数据:
dat <- read.table(text = " name1 name2
jim bob
jim bob
jim tom
jim sue
jim other
sue bob
sue tom
sue jim
bob bob
bob jim
bob bob
bob sue
bob jim
bob other
bob other",sep = "",header = TRUE)
如何使用 ggplot2 制作堆积条形图?我想name1
在 x 轴上,每个百分比name2
在 y 轴上。因此,对于jim
,它将bob
是tom
0.4、0.2、0.2sue
和other
0.2。
解决方案
推荐阅读
- javascript - 如何在Javascript中更新对象中的数组
- python - 列表中的 lambda 和过滤器
- c - SCHED_RR vs SCHED_FIFO 什么顺序?
- windows - 为什么窗口不会最小化或最大化?
- matlab - 二阶非线性 DE
- javascript - 每次有人在 Firebase 中注册时创建一个文档
- postman - 如何使我的测试循环通过 Postman 数组中的不同路径
- java - 可重试和恢复未在 SpringBatch 步骤中执行
- java - Unix 命令在一行中为后续问题预先确定了答案。管道不工作
- youtube - 带有用户访问令牌的 YouTube V3 数据 API 配额