statistics - Increasing barplot values in R -
i have managed "declare" empty barplot shown below using command:
barplot(c(0, 0, 0, 0, 0), names.arg = c("a", "b", "c", "d", "e"), ylim = c(0,1000))
how can "add" values bars such can achieve this:
you can this, though not ideal:
dat <- rep(na,5) barplot(dat, names.arg = c("a", "b", "c", "d", "e"), ylim = c(0,1000)) barplot(replace(rep(na,5),1,100), ylim = c(0,1000), yaxt="n", add=true) # ^---- position of new bar # ^------value of new bar
this won't work perfectly, if example want overwrite old bar lower value, close enough.
generally you'd better off saving data , redrawing entire plot each time.
Comments
Post a Comment