[R] ggplot2 / histogram / y-axis

Pete Kazmier pete-expires-20070910 at kazmier.com
Thu Jul 12 22:36:32 CEST 2007

"hadley wickham" <h.wickham at gmail.com> writes:

> On 7/12/07, Pete Kazmier <pete-expires-20070910 at kazmier.com> wrote:
>> Is there a way in ggplot to make a histogram with the left-hand y-axis
>> label as frequency, and a right-hand y-axis label as percentage?
> Not currently.  I did a quick exploration to see if it was feasible to
> draw another axis on with grid, but it doesn't look like it's
> possible:

Thank you for trying.

> Also how were you expecting the axes/gridlines to line up?  Would both
> axes be labelled "nicely" (with whole numbers) and the secondary axis
> wouldn't have gridlines; or would the second axis match the lines of
> the primary, even though the number wouldn't be so attractive?

I hadn't thought that far ahead.  Depending on the audience, I render
histograms differently, and was curious if I could just put both on a
single graph.  However, you bring up some interesting questions in
terms of the presentation.

On another note, and feel free to defer me to the documentation which
I'm still in the process of reading, but will I be able to take
advantage of some of Tufte's recommendations in terms of the typical
histogram and/or scatterplots (pp126-134 in Visual Display of
Quantitative Information)?

For example, with histograms, he would eliminates the use of
coordinate lines in favor of using a white grid to improve the
data/ink ratio.  Likewise in scatterplots, he uses range-frames and
dot-dash-plots.  Will I be able to use ggplot for these types of


More information about the R-help mailing list