[R] Question about ggplot2

Abhijit Dasgupta adasgupta at araastat.com
Tue Nov 2 15:30:26 CET 2010


from where you are, 

year.plot+ylim(0,0.1)

Abhijit

On Nov 2, 2010, at 9:57 AM, Shige Song wrote:

> 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")
> -------------------------------
> 
> Best,
> Shige
> 
> ______________________________________________
> 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.



More information about the R-help mailing list