[R] filled bars with patterns
a.mueller at cancer.org.uk
Wed Mar 13 21:17:20 CET 2002
Paul Murrell wrote:
> > yes, that's sort of what I was looking for. But I've to mix filled bars
> > with striped bars in a stacked barplot. I could just set the density for
> > the completely filled bars to something realy high (1000) but it's realy
> > slow to draw. Is there a way to mix stiped bars and filled pars in the
> > same plot?
> There may be a better way, but does the following do the sort of thing you
> want ...?
> m <- matrix(runif(30), ncol=5)
> barplot(m, beside=FALSE, col=rep(c("white", "light green", "pink"), 2),
> border=rep(c("white", "red"), 3), horiz=TRUE,
> xlim=c(0, 6), axes=FALSE)
> barplot(m, beside=FALSE, col="blue",
> density=rep(c(10, 5, -1), 2),
> angle=rep(c(45, -45, 0), 2), horiz=TRUE,
> xlim=c(0, 6))
As far as I can see the above code plots two graphs, one with filled and
one striped. I'd like to have filled and striped bars within the same
stacked dataset of the same plot (e.g filled red bar, then striped red
bar on top of the fileld red bar).
But maybe I can alter your code so that I construct the plot bar by bar
setting par(new = FALSE) (re-using the same plotting window). I'd have
to recalculate the x-positions for all the bars that have to be on-top
of the previous bars whenever I call barplot.
thanks for the suggestion,
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help