[R] Bar Plot ggplot2 Filling bars with cross hatching

Greg Snow Greg.Snow at imail.org
Tue Jan 20 18:11:22 CET 2009


The best thing to do really depends on your situation and what question you are trying to answer with your plot.  

Shades of grey has been mentioned, and in some cases that works, but you then run into the problem (same problem with colors and hatching density) of figuring out which bars to make light and which dark since a plot can have a very different visual impact depending on that choice.

Sometimes reordering and/or grouping/regrouping bars in a barplot can convey the information with the need for fewer visual distinguishers.  Dotplots have also been mentioned already, they are often an improvement on a barplot.  You can use different symbols for the dots (or even letters if overlap is small enough and the letters give more information) and labeling and grouping are more natural.  Sometimes a line plot is an appropriate alternative to a barplot.

Also take into account how the plot will be used/displayed, others have mentioned that what looks good on screen may not print out well (also true of cross-hatching).  I have seen some overhead projectors where the slide clearly had black and grey sections, but when projected, all the grey was black as well.  If this is something that will be photocopied, then colors/shades/hatches can change in that process and not be distinguishable.

Often the best strategy is to make multiple variations of a graph, then show them to someone else for an outside opinion of which best convey the information.

If you tell us a bit more about the specifics of the project, we may have more or better suggestions.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: stephen sefick [mailto:ssefick at gmail.com]
> Sent: Monday, January 19, 2009 5:37 PM
> To: Greg Snow
> Cc: hadley wickham; R-help
> Subject: Re: [R] Bar Plot ggplot2 Filling bars with cross hatching
> 
> what is your suggestion for distinguishing between many bars without
> color?  I have grown up in the time of standarized tests - good or bad
> I never felt nauseous.
> 
> Stephen
> 
> On Mon, Jan 19, 2009 at 5:20 PM, Greg Snow <Greg.Snow at imail.org> wrote:
> > I think the fact that the grid package does not support cross-
> hatching is a feature not a bug (or deficiency), and I hope that this
> is not "fixed".  Tufte's book (The Visual Display of Quantitative
> Information) has a section on why cross-hatching should be avoided
> (unless of course your goal is to induce nausea in the observer rather
> than convey information).
> >
> > I would edit Hadley's statement below to say "fortunately there's no
> way to do this in ggplot2".
> >
> > --
> > Gregory (Greg) L. Snow Ph.D.
> > Statistical Data Center
> > Intermountain Healthcare
> > greg.snow at imail.org
> > 801.408.8111
> >
> >
> >> -----Original Message-----
> >> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> >> project.org] On Behalf Of hadley wickham
> >> Sent: Thursday, January 15, 2009 10:55 AM
> >> To: stephen sefick
> >> Cc: R-help
> >> Subject: Re: [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 below
> >>
> >> ggplot2 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/
> >>
> >> ______________________________________________
> >> 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.
> >
> 
> 
> 
> --
> 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


More information about the R-help mailing list