Hello,
   I'm having fun exploring the pretty graphing options in R, although
I'm struggling to figure out how to do some simple things; would be
thankful if someone could point me toward relevant sections of the manual
or provide some starter code to get me going.

I'd like to extend what is offered in the manual here for stacked bar plots:

http://docs.ggplot2.org/current/geom_bar.html

For starters

library(ggplot2)
ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar()

Which makes a nice stacked barplot featuring counts on the y-axis. I'd like
to transform this to fraction or percentage, and (with some googling) came
up with this:

ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar(position = 'fill')

However, I prefer using  a line via frequency polygons.  Using counts, this
is:

ggplot(diamonds, aes(clarity, colour=cut)) + geom_freqpoly(aes(group = cut))

I'd like to adjust this to show fraction instead of counts on the y-axis
(as in the previous example), but this command is obviously incorrectly
constructed:

ggplot(diamonds, aes(clarity, colour=cut)) + geom_freqpoly(aes(group =
cut), position = 'fill')
Error: position_fill requires the following missing aesthetics: ymax

Any pointers would be appreciated.

Best,
Jonathan

	[[alternative HTML version deleted]]

