I use facet_wrap to build some data. Here is an example:
library (ggplot2) library (reshape) # generate some dummy data x = seq(0,1,0.05) precision = sqrt(x) recall = 1 - precision fmeasure = 2 * (precision * recall) / (precision + recall) # prepare it for plotting df = data.frame(x=x, precision=precision, recall=recall, fmeasure=fmeasure) df = melt(df, id.vars=c(x)) # plot it p = ggplot(df, aes(x=x, y=value, group=variable)) p = p + geom_line() + facet_wrap(~variable, ncol=3) p = p + coord_cartesian(xlim=c(0,1), ylim=c(0,1)) # second plot is without this line print (p)
Figure 1: Plot for the code above. 
However, what you see in Figure 1 is that the first and last labels of subsequent faces overlap. This could be fixed by increasing the space between the faces. Another option is to remove the xlim and ylim , as shown in Figure 2, but this saves unnecessary space in the cell itself.
Figure 2: The graph with the line p = p + coord_cartesian(xlim=c(0,1), ylim=c(0,1)) deleted. 
I tried to increase the space between the faces, but so far I have not been able to do this. Do you have any tips?
I am using ggplot2 version 0.9.1.
source share