Re: [R] ggplot problem
Dear Greg, Make sure that your x variable (Betas) is categorical. That is required for geom_boxplot(). And please do read the posting guide. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2017-05-23 23:59 GMT+02:00 greg holly : > Hi all; > > When I run the following program substantially I have "Warning message: > position_dodge requires non-overlapping x intervals" > > How I can overcome this problem. > > Regards, > > Greg > > p <- ggplot() + geom_point(data=a, aes(x=Betas, y=Traits, color= > Super.Pathway), shape=15, size=4) > > p <- p + guides(color=guide_legend(title=NULL)) > > p <- p + theme(legend.key = element_blank()) > > p <- p + geom_boxplot(data=a,aes(x=Betas,fill=factor(Super. > Pathway),y=Traits)) > + guides(fill=FALSE) +scale_x_continuous(breaks = seq(-50, 60, 5)) > > p > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] ggplot problem
Hi all; When I run the following program substantially I have "Warning message: position_dodge requires non-overlapping x intervals" How I can overcome this problem. Regards, Greg p <- ggplot() + geom_point(data=a, aes(x=Betas, y=Traits, color= Super.Pathway), shape=15, size=4) p <- p + guides(color=guide_legend(title=NULL)) p <- p + theme(legend.key = element_blank()) p <- p + geom_boxplot(data=a,aes(x=Betas,fill=factor(Super.Pathway),y=Traits)) + guides(fill=FALSE) +scale_x_continuous(breaks = seq(-50, 60, 5)) p [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] ggplot: Problem with legend background
Hi Luc, You want: legend.title=theme_text(size=20, hjust = 0) So the legend title is left aligned, not centred. Hadley On Fri, Dec 11, 2009 at 9:26 AM, MUHC_Research wrote: > > Dear R-users, > > I am preparing graphs for an upcoming article using the different functions > of the ggplot2 package and I've been having problems with the legend > background. It doesn't seem to scale when the text size is increased. Here's > the mandatory reproducible example: > > library(ggplot2) > repFrame <- data.frame(A= 1:10, B= rnorm(1:10), groupNum = rep(c("First > group", "Second group"),each=5)) > testPlot <- ggplot(repFrame, aes(x=A, y = B, group = groupNum)) + > opts(legend.position=c(0.85,0.3), legend.background = > theme_rect(fill="white"), legend.text=theme_text(size=16), > legend.title=theme_text(size=20)) > testPlot + geom_point(aes(colour= groupNum)) > > As you can see, the text doesn't fit in the white rectangle. I suspect there > is a theme setting I could modify to fix this, but I can't seem to find > which one. > > I sincerely thank you for your time and assistance. > > Luc > -- > View this message in context: > http://n4.nabble.com/ggplot-Problem-with-legend-background-tp961142p961142.html > Sent from the R help mailing list archive at Nabble.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. > -- http://had.co.nz/ __ 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.
[R] ggplot: Problem with legend background
Dear R-users, I am preparing graphs for an upcoming article using the different functions of the ggplot2 package and I've been having problems with the legend background. It doesn't seem to scale when the text size is increased. Here's the mandatory reproducible example: library(ggplot2) repFrame <- data.frame(A= 1:10, B= rnorm(1:10), groupNum = rep(c("First group", "Second group"),each=5)) testPlot <- ggplot(repFrame, aes(x=A, y = B, group = groupNum)) + opts(legend.position=c(0.85,0.3), legend.background = theme_rect(fill="white"), legend.text=theme_text(size=16), legend.title=theme_text(size=20)) testPlot + geom_point(aes(colour= groupNum)) As you can see, the text doesn't fit in the white rectangle. I suspect there is a theme setting I could modify to fix this, but I can't seem to find which one. I sincerely thank you for your time and assistance. Luc -- View this message in context: http://n4.nabble.com/ggplot-Problem-with-legend-background-tp961142p961142.html Sent from the R help mailing list archive at Nabble.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.
Re: [R] ggplot: problem with fill option in stat_smooth()
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 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 > __ 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.
Re: [R] ggplot: problem with fill option in stat_smooth()
Thanks. That fixed it. But I should've been careful about what I asked for. Now the graphs are basically unusable without transparency because the bands overlap so much. I'm still looking for a way to get transparency into Word without resorting to raster graphics. On Wed, Feb 4, 2009 at 12:55 PM, hadley wickham wrote: > On Wed, Feb 4, 2009 at 10:55 AM, Ian Fiske wrote: >> Thanks for the suggestion, Hadley. I tried: >> >> stat_smooth(fill=alpha("grey",1)) >> >> 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 >> PDF. >> >> Am I doing this correctly? > > Oops, I should have been more clear. You want: > > + stat_smooth(alpha = 1) > > Hadley > > -- > http://had.co.nz/ > __ 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.
Re: [R] ggplot: problem with fill option in stat_smooth()
On Wed, Feb 4, 2009 at 10:55 AM, Ian Fiske wrote: > Thanks for the suggestion, Hadley. I tried: > > stat_smooth(fill=alpha("grey",1)) > > 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 > PDF. > > Am I doing this correctly? Oops, I should have been more clear. You want: + stat_smooth(alpha = 1) Hadley -- http://had.co.nz/ __ 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.
Re: [R] ggplot: problem with fill option in stat_smooth()
Thanks for the suggestion, Hadley. I tried: stat_smooth(fill=alpha("grey",1)) 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 PDF. Am I doing this correctly? -ian On Wed, Feb 4, 2009 at 11:07 AM, hadley wickham wrote: > On Wed, Feb 4, 2009 at 9:12 AM, 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") > > It's not - you actually need alpha = 1. I'll make a note to fix the > documentation. > > Hadley > > -- > http://had.co.nz/ > __ 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.
Re: [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. __ 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.
Re: [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]] __ 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.
Re: [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 wrote: > From: Ian Fiske > Subject: [R] ggplot: problem with fill option in stat_smooth() > To: r-help@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@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. __ 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.
Re: [R] ggplot: problem with fill option in stat_smooth()
On Wed, Feb 4, 2009 at 9:12 AM, 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") It's not - you actually need alpha = 1. I'll make a note to fix the documentation. Hadley -- http://had.co.nz/ __ 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.
[R] ggplot: problem with fill option in stat_smooth()
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@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.