我有数据框(例如)
df <-data.frame(apport=c("Org 2016","Min 1","Min 2","Min 3"),
Aou_14=c(7.69,0,0,0), Sep_16=c(7.69,0,0,0),Sep_17=c(15.38,0,0,0),
Oct_18=c(46.15,0,0,0),Oct_19=c(7.69,0,0,0),Nov_20=c(15.38,0,0,0),
Fev_27=c(0,50,0,0),Mar_28=c(0,50,0,0), Mar_29=c(0,0,62.5,0),
Avr_30=c(0,0,25,0),Avr_31=c(0,0,12.5,0),Mai_32=c(0,0,0,50),
Mai_33=c(0,0,0,50))
list<-c("Jan_0", "Jan_1", "Fev_2", "Fev_3","Mar_4", "Mar_5", "Avr_6", "Avr_7", "Mai_8", "Mai_9", "Jui_10", "Jui_11", "Jul_12", "Jul_13", "Aou_14", "Aou_15", "Sep_16", "Sep_17", "Oct_18", "Oct_19", "Nov_20","Nov_21", "Dec_22", "Dec_23", "Jan_24", "Jan_25", "Fev_26", "Fev_27", "Mar_28", "Mar_29", "Avr_30","Avr_31", "Mai_32", "Mai_33", "Jui_34", "Jui_35", "Jul_36", "Jul_37", "Aou_38",
"Aou_39", "Sep_40", "Sep_41", "Oct_42", "Oct_43", "Nov_44", "Nov_45", "Dec_46", "Dec_47")
我用 ggplot 做了一个条形图
p1 <- ggplot(dates2, aes(x=periode_ap, y=pourcentage_parc, fill=apport))+
geom_col(position = position_stack(reverse = TRUE))+
ylim(0,100)+
scale_fill_manual(values=mycolors, name="")+
theme_light()+scale_x_discrete(labels = list)