On 3/16/2012 10:29 AM, mdvaan wrote:
Hi,

This is probably an easy one, but I am new to ggplot2 and cannot find an
answer online.

Just so you know, there is a mailing list devoted to ggplot2. You can subscribe and view messages at https://groups.google.com/forum/?fromgroups#!forum/ggplot2

I am bar plotting values of 10 groups. These values are all within a 90-100
range, so I would like leave out the area of the bars below 90. If I say
"graph + scale_y_continuous(limit=c(90, 100))", it does limit the axis but
the bars disappear completely. Any solution here?

You want to zoom the axes, not limit the scales (very different concepts in ggplot2). You need

graph + coord_cartesian(ylim=c(90,100))

Now, I'm going to tell you that you shouldn't do that. Bars go to 0. That is because the information in the bar (visually) is in its length. By cutting the bars off, you are distorting them. Effectively, this is what you did with the scale call; you said to throw out any data outside the range of 90-100. Since the bottom of the bar was below that, it got thrown out, so the rest of the bar got thrown out as well.

If you only want to show the 90-100 range, consider just points.

Thanks a lot!

Mathijs


--
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health & Science University

______________________________________________
R-help@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.

Reply via email to