stephen sefick
2009-Jan-15 03:18 UTC
[R] Bar Plot ggplot2 Filling bars with cross hatching
#I am putting a test together for an introductory biology class and I would like to put different cross hatching inside of each bar for the bar plot below color <- c("Brightly Colored", "Dull", "Neither") lizards <- c(277, 70, 3) liz.col <- data.frame(color, lizards) qplot(color, lizards, data=liz.col, geom="bar", ylab="Observed Matings", main="Counts Out of 350 Aquariums", ylim=c(0,400), fill=color)+scale_y_continuous(breaks=c(0, 70, 277, 350)) Thanks -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
stephen sefick
2009-Jan-15 03:24 UTC
[R] Bar Plot ggplot2 Filling bars with cross hatching
Also notice that the q in Aquarium is hidden. Is there a way to make this not happen? thanks Stephen Sefick On Wed, Jan 14, 2009 at 10:18 PM, stephen sefick <ssefick at gmail.com> wrote:> #I am putting a test together for an introductory biology class and I > would like to put different cross hatching inside of each bar for the > bar plot below > > color <- c("Brightly Colored", "Dull", "Neither") > lizards <- c(277, 70, 3) > liz.col <- data.frame(color, lizards) > qplot(color, lizards, data=liz.col, geom="bar", ylab="Observed > Matings", main="Counts Out of 350 Aquariums", ylim=c(0,400), > fill=color)+scale_y_continuous(breaks=c(0, 70, 277, 350)) > > > Thanks > -- > Stephen Sefick > > Let's not spend our time and resources thinking about things that are > so little or so large that all they really do for us is puff us up and > make us feel like gods. We are mammals, and have not exhausted the > annoying little problems of being mammals. > > -K. Mullis >-- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
hadley wickham
2009-Jan-15 17:54 UTC
[R] Bar Plot ggplot2 Filling bars with cross hatching
Hi Stephen,> #I am putting a test together for an introductory biology class and I > would like to put different cross hatching inside of each bar for the > bar plot belowggplot2 uses the grid package to do all the drawing, and currently grid doesn't support cross-hatching, so unfortunately there's no way to do this in ggplot2. Regards, Hadley -- http://had.co.nz/
Gabor Grothendieck
2009-Jan-20 00:59 UTC
[R] Bar Plot ggplot2 Filling bars with cross hatching
If classic graphics is ok try this which uses hatches and different shades of grey: barplot(lizards, names.arg = color, col = grey(c(.2, .5, 1)), density = 20, angle = c(45, -45, 0), legend = color) On Wed, Jan 14, 2009 at 10:18 PM, stephen sefick <ssefick at gmail.com> wrote:> #I am putting a test together for an introductory biology class and I > would like to put different cross hatching inside of each bar for the > bar plot below > > color <- c("Brightly Colored", "Dull", "Neither") > lizards <- c(277, 70, 3) > liz.col <- data.frame(color, lizards) > qplot(color, lizards, data=liz.col, geom="bar", ylab="Observed > Matings", main="Counts Out of 350 Aquariums", ylim=c(0,400), > fill=color)+scale_y_continuous(breaks=c(0, 70, 277, 350)) > > > Thanks > -- > Stephen Sefick > > Let's not spend our time and resources thinking about things that are > so little or so large that all they really do for us is puff us up and > make us feel like gods. We are mammals, and have not exhausted the > annoying little problems of being mammals. > > -K. Mullis > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >