【发布时间】:2021-04-17 10:49:11
【问题描述】:
我的数据集包含儿童及其看护人讲话中使用的声门级别。因子是Speaker (a, amum, b, bmum ...), Category (child, caregiver) 和Pair (a and amum ...)。
我的情节使用以下代码显示了 22 位说话者的声门化水平:
ggplot(data1, aes(x = Speaker, fill=Glottals, colour = Category)) +
geom_bar(position ="fill") + scale_fill_manual(values = c("White", "grey")) +
theme_minimal() + ggtitle ("Percent glottals for caregiver pairs") + ylab("Percent") + scale_y_continuous(labels = scales::percent) + xlab("Speaker") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + theme(legend.position = "none")
输出如下:
我想以两种颜色显示条形(儿童/看护人),并在每对之间留一个空格。
A tibble: 3,303 x 15
Context Transcript Pair Speaker Ch_Gender Age Category ID Gender Before Text After Phon Glottals Sitcon
<fct> <fct> <fct> <fct> <fct> <dbl> <fct> <int> <fct> <fct> <fct> <fct> <fct> <fct> <fct>
1 Home David_H1.trs David David M 3.2 Child 3 M "It's not* coming" out "" coda pause t routine
2 Home David_H1.trs David David M 3.2 Child 3 M "I'll (inc)" that "out." coda vowel ? routine
3 Home David_H1.trs David David M 3.2 Child 3 M "I'll (inc) that" out. "" coda pause ? routine
4 Home David_H1.trs David David M 3.2 Child 3 M "" Butter "" Intervocalic t routine
5 Home David_H1.trs David David M 3.2 Child 3 M "" Butter "Flour" Intervocalic t routine
6 Home David_H1.trs David David M 3.2 Child 3 M "Mummy there's the" butter "" Intervocalic t routine
7 Home David_H1.trs David David M 3.2 Child 3 M "Mummy can you open" that? "" coda pause ? routine
8 Home David_H1.trs David David M 3.2 Child 3 M "Mummy I" want-- "" coda pause ? routine
9 Home David_H1.trs David David M 3.2 Child 3 M "I want to do the" butter "" Intervocalic t routine
10 Home David_H1.trs David David M 3.2 Child 3 M "I wanna do the" fruit "" coda pause ? routine
# ... with 3,293 more rows
>
【问题讨论】:
标签: r ggplot2 grouping subset factors