[S] barplots and different patterns for each bar

eric.gibson@pharma.Novartis.com
Tue, 27 Oct 1998 15:07:34 -0500


Dear colleagues,

How do I get the patterns of shading to be different in
a side-by-side barplot? I'm not referring to simply
using 2 different angles and two different densities
such as angle=c(35,135), density=c(10,50).
In SAS graph I can ask for two different patterns of shading,
such as stripes versus polka dots.

Suppose we have a set of 8 numbers representing the average
percent change from baseline in the primary variable for
all patients by treatment and week.

Week 4 8 12 16
Drug 72 68 74 78
Placebo 23 18 12 12

What follows is the code I have used for creating a side-by-side barplot.

graphsheet(width=6, height=8, pointsize=12, orientation="portrait",
units.per.inch=1, format = "wmf", file="D:\\bar.wmf",
object.mode="fast")

data<-c(72,23,68,18,74,12,78,12)

bar1<-barplot(data, beside=T, space=c(.25,0), width=2.0, angle=c(35,135),
density=c(10,10), col=1, ylab="Percent Reduction", xlab="Weeks",
ylim=c(0,100) )

axis(side=1, at=apply(matrix(bar1,nrow=2), 2, mean),
labels=c("4","8","12","16"),ticks=T)

legend(locator(1), c("Drug","Placebo"), angle=c(35,135),
density=c(10,10),col=1)

text(bar1,data+3,signif(data,3))

dev.off()

Perhaps barchart is what I need rather than barplot?

Thanks in advance,
Eric Gibson, Ph.D.
Novartis Pharmaceuticals
The opinions expressed herein are those of Eric Gibson and
in no way represent Novartis Pharmaceuticals.
eric.gibson@pharma.novartis.com

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news