[R] graphics

Douglas Bates bates at stat.wisc.edu
Thu Jan 16 19:29:03 CET 2003


Federico Calboli <f.calboli at ucl.ac.uk> writes:

> Dear R community,
> 
> I need to plot the results of some simulations I did using QTL
> Cartographer. I am plotting LOD scores over three chromosomes. The three
> plot have to be one next to the other. 
> 
> The procedure I am using is:
> 
> par(mfrow=c(1,3))
> plot(x$x, x$y, ylim=c(0,35), type="l", col="blue", las=1, xaxs="i",
> yaxs="i", xlab="X Chromosome", ylab="LOD")
> abline(h=3.055)
> 
> plot(ch2$x, ch2$y, ylim=c(0,35), type="l", col="blue", yaxt="n", xaxs="i",
> yaxs="i", xlab="Chromosome 2", ylab="")
> abline(h=3.055)
> 
> plot(ch3$x, ch3$y, ylim=c(0,35), type="l", col="blue", yaxt="n", xaxs="i",
> yaxs="i", xlab="Chromosome 3", ylab="")
> abline(h=3.055)
> 
> This works fine but I would like to improve it a bit. I would like the same
> scaling along the x axis so that the plot for longer chromosomes and
> shorter ones looks "in scale". Second thing, I'd like to have the three
> plots much closer together, the space between plots given by mfrow at the
> moment is far too much.

xyplot in the lattice package is the natural way of doing this.  There
is a "learning curve" in getting used to lattice but it is worth the
effort.




More information about the R-help mailing list