[R] ggplot: problem with fill option in stat_smooth()

Ian Fiske ianfiske at gmail.com
Wed Feb 4 17:55:22 CET 2009

Thanks for the suggestion, Hadley.  I tried:


and got the same problem.  The shaded band shows up in the graphics
windows, but the only file format the keeps the confidence band is

Am I doing this correctly?


On Wed, Feb 4, 2009 at 11:07 AM, hadley wickham <h.wickham at gmail.com> wrote:
> On Wed, Feb 4, 2009 at 9:12 AM, Ian Fiske <ianfiske at gmail.com> wrote:
>> Hi all,
>> I am using ggplot2 and continuing to find it very useful and pretty.
>> However, I am trying to create some graphics for publication that would be
>> included in an MS Word document (not my choice!) in Windows Vista.
>> The problem is that I want to use stat_smooth() to add an fitted linear
>> model line along with its 95% confidence band, but I cannot seem to get the
>> confidence band in a format that would import into Word.  I have read the
>> documentation and am using the fill="grey50" argument to eliminate
>> transparency as a potential problem.  But still, I have tried nearly all
>> export formats and the only one that correctly shows the confidence band is
>> PDF, which I cannot import into Word as a vector graphic.
>> This makes me wonder if the fill="grey50" option is working as advertised.
>> Here is a simple example using the mtcars data set included with ggplot2:
>> qplot(wt,mpg,data=mtcars) + stat_smooth(fill="grey50")
> It's not - you actually need alpha = 1.  I'll make a note to fix the
> documentation.
> Hadley
> --
> http://had.co.nz/

More information about the R-help mailing list