[R] Question about ggplot2

Shige Song shigesong at gmail.com
Tue Nov 2 14:57:46 CET 2010

Dear All,

I am trying to graph a simple scatter plot where the x axis is year
and the y axis is a percentage (percentage of infant death). Instead
of plotting the raw data, I want to plot summary statistics such as
mean and median. Here is the problem: the value range of y is between
0 and 1, but since infant death is a rare event, the mean and median
is very low (something like 5%), which shows up as a horizontal line
at the bottom of the figure. My question is: how do I change the scale
of the y-axis so that it does not have the range between 0 and 1 but
between 0 and 0.1? Many thanks.

By the way, I am using ggplot2, and here is my code:

year.plot <- ggplot(d, aes(year, rate))
year.plot + stat_summary(fun.y = "mean", geom = "line")


More information about the R-help mailing list