r - 如何自定义多图饼图的“单饼图”位置?
问题描述
我创建了一个多饼图。这些是代码 -
Title = c("Male","Male","Male",
"Female","Female","Female",
"Both", "Both","Both")
BDD_Level = c('Subclinical BDD','Mild-Moderate BDD','Moderate-Severe BDD',
'Subclinical BDD','Mild-Moderate BDD','Moderate-Severe BDD',
'Subclinical BDD','Mild-Moderate BDD','Moderate-Severe BDD')
value = c(0.90, 0.09, 0.01,
0.84, 0.14, 0.02,
0.87, 0.11, 0.02)
piec<-data.frame(Title,BDD_Level,value)
ggplot(piec, aes("", value, fill = BDD_Level)) +
geom_bar(stat = "identity", size = 3) +
geom_text(aes(label = paste0(value * 100, "%")),
position = position_stack(vjust = 0.5),
color = "white", size = 4) +
coord_polar(theta = "y") +
facet_wrap(~ Title, nrow = 1) +
scale_fill_manual(values = c("#d45087", "#f95d6a","#ffa600"
)) +
theme_void()+
因此,我想将标题为“Both”的饼图放在该图的最右侧,并将“Male”饼图放在该图的最左侧。
另外,如果我使用nrow=2
功能。如何将第二行的情节从一侧带到中间?
解决方案
推荐阅读
- android - 有没有办法不重绘/使视图无效,而是使用适合新缩放宽度和高度的布局来缩放 X 和缩放 Y?
- python - 在ajax中使用formdata传递数组
- python - Tkinter - 如何绑定按键(不是按钮)来调用函数?
- c# - 如何运行 dotnet new 命令并直接在代码中创建新项目
- php - WooCommerce 订单相关预订的自定义电子邮件主题占位符
- c# - 根据另一个列表的顺序对列表进行排序
- python - 如何在 html 中查找具有“赞助帖子”类的元素?
- python - 将星期几插入 Python 数据框中
- python - 当除数和/或被除数是浮点数时,为什么 Python 地板除法会返回浮点数?
- excel - 匹配单元格(使用 Vlooking、索引、匹配)