0

i am quite new to R studio and I just can't figure out, how I can combine stacke bar and a normal barplot...I know the question has been answered before - but i do not work with ggplot yet (its too complicated for me right now.. will try my best to understand it another time).

This is how my graph looks like now: enter image description here

This was my coding to this graph:

par(font.axis=2)
par(mar=c(5,4,6,8))
barplot(as.matrix(data), beside = TRUE, ylab="number of cells / well",
        ylim=c(0,350000),cex.axis=1,cex.lab=1.25,col=c("darkorchid4","gainsboro","darkolivegreen4"),
        legend("topright",c("alive","dead","sawed cells / well"),
               fill=c("darkorchid4","gainsboro","darkolivegreen4")))

What i actually want is that "alive and dead" are a stacked bar, and sawed cells is a normal bar plot beside the stacked bar... ist that even possible?

Thanks for any help :)

This is my Excel sheet that i've worked with enter image description here

Sara
  • 1
  • 1
  • You probably need to do `horiz=TRUE` in a second stacked plot, set `add=TRUE` to combine with the first plot. – jay.sf Oct 27 '19 at 14:58
  • Please `dput` your data for [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Parfait Oct 27 '19 at 14:58
  • Thank you for your answer... iam not sure if I understand what you mean.. thats why I made this screenshot of my Excel Sheet which I imported to R studio – Sara Oct 27 '19 at 15:07
  • We cannot create your data from the picture, unless you expect us to type it all in. The easier it is for people to copy & paste your data and code into their own R-session the more likely they are to find your problem and help. So please use `dput` to give us some real data to work with. – Phil Oct 29 '19 at 14:10

0 Answers0