[R] help on bar chart

ppcrystal cindyyql at hotmail.com
Sat Jul 3 07:47:08 CEST 2010


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!!!
-- 
View this message in context: http://r.789695.n4.nabble.com/help-on-bar-chart-tp2277107p2277107.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list