Skip to content
Prev 226278 / 398500 Next

help on bar chart

Hey guys,

This is the bar chart that I am working on:

library(lattice);
data <- data.frame(
	X1 = c(2300, 1300, 1300, 450),
	X2 = c(2110, 2220, 1100, 660),
	Y = factor(c("sample1", "sample2", "sample3", "sample4"))
	);
barchart(
	Y ~ X1 + X2,
	data,
	stack = TRUE,
	horiz = TRUE,
	lwd = 1.5,
	xlab = expression(bold("Sample size")),
	col = colors()[c(24,1)],
	xlim = c(0,5000),
	xat = seq(0,5000,1000)
	);

I wanted to make a bar chart that has hatching lines inside the bar: with
sample 2 and 4 having vertical lines and sample 1 and 3 having horizontal
lines, like the following (I kind of photoshopped the image to demonstrate
what I wanted it to look like):

http://r.789695.n4.nabble.com/file/n2277107/test.png 

Anyone knows how I can add hatching to the bar charts?

Thanks very much for your time!!!