[R] ggplot geom_boxplot vertical margins
If you plot: df-data.frame(x=factor(1:100),y=rnorm(1000)) ggplot(df,aes(x=x,y=y))+geom_boxplot() How do I remove those pesky margins on the sides of the plot area? Or maybe just reduce their size to something more like the spacing of the boxes? Thanks, Justin __ 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 geom_boxplot vertical margins
Is this what you want? You can control how much space you want to see on the sides of the plot: df-data.frame(x=factor(1:100),y=rnorm(1000)) ggplot(df,aes(x=x,y=y))+geom_boxplot() + scale_x_discrete(expand=c(0,0)) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx - Original Message From: Justin Haynes jto...@gmail.com To: r-help@r-project.org Sent: Wed, May 18, 2011 1:51:19 PM Subject: [R] ggplot geom_boxplot vertical margins If you plot: df-data.frame(x=factor(1:100),y=rnorm(1000)) ggplot(df,aes(x=x,y=y))+geom_boxplot() How do I remove those pesky margins on the sides of the plot area? Or maybe just reduce their size to something more like the spacing of the boxes? Thanks, Justin __ 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 geom_boxplot vertical margins
Exactly! Thanks, I couldn't find that anywhere! On Wed, May 18, 2011 at 1:59 PM, Felipe Carrillo mazatlanmex...@yahoo.com wrote: Is this what you want? You can control how much space you want to see on the sides of the plot: df-data.frame(x=factor(1:100),y=rnorm(1000)) ggplot(df,aes(x=x,y=y))+geom_boxplot() + scale_x_discrete(expand=c(0,0)) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx - Original Message From: Justin Haynes jto...@gmail.com To: r-help@r-project.org Sent: Wed, May 18, 2011 1:51:19 PM Subject: [R] ggplot geom_boxplot vertical margins If you plot: df-data.frame(x=factor(1:100),y=rnorm(1000)) ggplot(df,aes(x=x,y=y))+geom_boxplot() How do I remove those pesky margins on the sides of the plot area? Or maybe just reduce their size to something more like the spacing of the boxes? Thanks, Justin __ 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.