Dear Josh, This is exactly what I want, thank you so much!
Best, Shige On Tue, Nov 2, 2010 at 8:25 PM, Joshua Wiley <jwiley.ps...@gmail.com> wrote: > Dear Shige, > > This is a feature that lets you view information about the specific > data you are viewing. If you merely want a visual adjustment, use > coord_cartesian(): > > year.plot + stat_summary(fun.y = "mean", geom = "line") + > coord_cartesian(xlim = c(0, 0.1)) > > HTH, > > Josh > > On Tue, Nov 2, 2010 at 5:20 PM, Shige Song <shiges...@gmail.com> wrote: >> Dear Josh and Abhijit, >> >> Thanks for the help. The interesting thing is that the option "limits >> = c(0, .1)" or "ylim(0,0.1)" also eliminates cases whose values are >> greater than 0.1 and report missing values, which is not what I want. >> Is there a way to keep all the cases for the computation of the >> summary statistics and change the y limits in the final graph? >> >> Shige >> >> On Tue, Nov 2, 2010 at 10:33 AM, Joshua Wiley <jwiley.ps...@gmail.com> wrote: >>> Dear Shige, >>> >>> You can use scale_y_continuous() to achieve this. >>> >>> year.plot <- ggplot(d, aes(year, rate)) >>> year.plot + stat_summary(fun.y = "mean", geom = "line") + >>> scale_y_continuous(limits = c(0, .1)) >>> >>> where limits may be whatever you like for the y axis. >>> >>> Cheers, >>> >>> Josh >>> >>> On Tue, Nov 2, 2010 at 6:57 AM, Shige Song <shiges...@gmail.com> 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@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. >>>> >>> >>> >>> >>> -- >>> Joshua Wiley >>> Ph.D. Student, Health Psychology >>> University of California, Los Angeles >>> http://www.joshuawiley.com/ >>> >> > > > > -- > Joshua Wiley > Ph.D. Student, Health Psychology > University of California, Los Angeles > http://www.joshuawiley.com/ > ______________________________________________ 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.