plot stacked bar plot in R

后端 未结 2 1122
礼貌的吻别
礼貌的吻别 2020-12-01 22:00

I would like to create histogram [stacked bar plot] in R with data like this:

Period = c(1,1,2,2,3,3,4,4)                              
Sample = c(\"A\",\"B\         


        
2条回答
  •  时光取名叫无心
    2020-12-01 23:00

    It's not as pretty as the ggplot solution but

    v <- rbind(Value1,Value2)
    barplot(v,beside=FALSE,names=levels(interaction(Period,Sample)),legend=TRUE)
    

    seems to work.

提交回复
热议问题