简体   繁体   中英

Names in geom_bar with ggplot2

I need some help with this graph, here's my code

ggplot(aes(x=situa_ence,fill=cs_sexo), data=dados) +  
  geom_bar(aes(y = (..count..)/sum(..count..)))

I need to put names in each bar

在此处输入图片说明

(1 =Sick, 2 = Not sick )

使用ifelse()

dados$situa_ence <- ifelse(dados$situa_ence == 1, yes = "Sick", no = "Not sick")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM