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") I even tried the Cairo library as one R-help post suggested, but to no avail. Any suggestions? Thanks much, Ian Fiske -- View this message in context: http://www.nabble.com/ggplot%3A-problem-with-fill-option-in-stat_smooth%28%29-tp21832398p21832398.html Sent from the R help mailing list archive at Nabble.com.
hadley wickham
2009-Feb-04 16:07 UTC
[R] ggplot: problem with fill option in stat_smooth()
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/
Felipe Carrillo
2009-Feb-04 16:10 UTC
[R] ggplot: problem with fill option in stat_smooth()
Ian: It would work if you copy it as a bitmap. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On Wed, 2/4/09, Ian Fiske <ianfiske at gmail.com> wrote:> From: Ian Fiske <ianfiske at gmail.com> > Subject: [R] ggplot: problem with fill option in stat_smooth() > To: r-help at r-project.org > Date: Wednesday, February 4, 2009, 7:12 AM > 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") > > I even tried the Cairo library as one R-help post > suggested, but to no > avail. > > Any suggestions? > > Thanks much, > Ian Fiske > -- > View this message in context: > http://www.nabble.com/ggplot%3A-problem-with-fill-option-in-stat_smooth%28%29-tp21832398p21832398.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.
Etienne Bellemare Racine
2009-Feb-04 16:17 UTC
[R] ggplot: problem with fill option in stat_smooth()
Maybe you could try to open the pdf in Inkscape http://www.inkscape.org/ and export it as a .emf or .png ? Etienne Ian Fiske a écrit :> 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") > > I even tried the Cairo library as one R-help post suggested, but to no > avail. > > Any suggestions? > > Thanks much, > Ian Fiske >[[alternative HTML version deleted]]
Etienne B. Racine
2009-Feb-04 16:35 UTC
[R] ggplot: problem with fill option in stat_smooth()
Maybe you could try to open the pdf in Inkscape http://www.inkscape.org/ and export it as a .emf or .png ? Etienne Ian Fiske 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") > > I even tried the Cairo library as one R-help post suggested, but to no > avail. > > Any suggestions? > > Thanks much, > Ian Fiske >-- View this message in context: http://www.nabble.com/ggplot%3A-problem-with-fill-option-in-stat_smooth%28%29-tp21832398p21834181.html Sent from the R help mailing list archive at Nabble.com.
Thanks for the suggestion, Etienne. It looks like this might be the best approach after all, using a high resolution png exported from Inkscape. I'm impressed by its flawless pdf import! -ian On Wed, Feb 4, 2009 at 11:15 AM, Etienne Bellemare Racine <etiennebr at gmail.com> wrote:> Maybe you could try to open the pdf in Inkscape http://www.inkscape.org/ and > export it as a .emf or .png ? > > Etienne > > Ian Fiske a ?crit : > > 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") > > I even tried the Cairo library as one R-help post suggested, but to no > avail. > > Any suggestions? > > Thanks much, > Ian Fiske >