Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-19 Thread Dennis Murphy
library(ggplot2) library(gridExtra) #generate test precipitation data year-c(2000,2001,2002,2003,2004) precip-c(46,100,80,74,20) yp-data.frame(year, precip) #generate test fecal coliform data year2-c(2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,

Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-19 Thread Saalem Adera
Hi all, Thanks for the quick replies. Dennis - I tried rotating the y-axis tick labels 90 degrees and while the x-axes became the same width, the x-axis values still didn't line up with each other. So maybe I need to be more clear - how can I get the x-axis tick values to line up? For example,

Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-19 Thread David Winsemius
Adding this to the first plot object seems to come pretty close: yp_plot + xlim(1999.6, 2004.4) I also tried adding and subtracting 0.5. It does not appear that 0.4 is an exact solution. -- David On Apr 19, 2013, at 8:49 AM, Saalem Adera wrote: Hi all, Thanks for the quick replies.

Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-19 Thread David Winsemius
On Apr 19, 2013, at 2:06 PM, Saalem Adera wrote: Thanks! I really appreciate everyone's help. I was able to get the x-axes ticks very close (close enough!) to lining up on the test data using both Dennis and David's code. So, I've got a work-around. However, I need to do this same

Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-19 Thread Saalem Adera
Thanks! I really appreciate everyone's help. I was able to get the x-axes ticks very close (close enough!) to lining up on the test data using both Dennis and David's code. So, I've got a work-around. However, I need to do this same operation for many other sets of plots, with varied data

[R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-18 Thread Saalem Adera
Hi all, I want to arrange two ggplot2 plots on the same page with their x-axes lined up - even though one is a boxplot and the other is a line plot. Is there a simple way to do this? I know I could do this using facetting if they were both the same type of plot (for example, if they were both

Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-18 Thread Andrés Aragón Martínez
Hi Saalem, Check the following: http://www.cookbook-r.com/Graphs/Multiple_graphs_on_one_page_(ggplot2)/ Regards, Andrés AM El 18/04/2013, a las 09:47, Saalem Adera saalemad...@gmail.com escribió: Hi all, I want to arrange two ggplot2 plots on the same page with their x-axes lined up -