Вставка меток% на гистограмму с накоплением ggplot - PullRequest
0 голосов
/ 16 июня 2020

Я хочу добавить метки% к моей линейчатой ​​диаграмме с накоплением. Вот мои данные.

discipline      <- c("Physician", "Social Worker", "NP/PA", "Case Manager", "Nurse", "Pharmacist", "Administrative"))
variable <- c("aware", "confident", "issue", "scope", "concerned", "access"))
response <- c("N/A", "Strongly Agree", "Agree", "Neutral", "Disagree", "Strongly Disagree") 
Data      <- data.frame(discipline, variable, response)

Вот мой код без меток.

ggplot(incorporation)+
geom_bar(aes(fill = response, x = (..count..)/sum(..count..),
y = factor(reorder(variable,desc(response))),),
position = "fill")+
theme(axis.text.x = element_text(angle = -90, hjust = 0),
axis.title.y = element_blank(),
axis.title.x = element_blank())+
scale_fill_brewer(palette = "RdYlGn", direction = -1)+
scale_x_continuous(labels = scales::percent)

enter image description here

...