Hi,

Have you considered using high-level plotting functions provided by the ggplot2 or lattice package? Here's a dummy example,


x <- seq(0, 10, length=100)
y1 <- sin(x)
y2 <- cos(x)
y3 <- x^2/100
y4 <- 1/x

d <- data.frame(x, y1, y2, y3, y4)

library(reshape)
dm <- melt(d, id="x")

dm$type1 <- rep(LETTERS[1:2], each=2*length(x)) # dummy factors
dm$type2 <- rep(letters[1:2], each=length(x))

library(ggplot2)
p1 <-
qplot(x, value, data=dm, geom="line", facets=type1~type2)

p1 # you can customise the appearance if the default doesn't please you

library(lattice)

p2 <-
xyplot(value~x|type1*type2, data=dm, t="l") # here the strips are on top of each other by default

library(latticeExtra)

useOuterStrips(p2) # this makes the layout more like you want


Alternatively, you can also use raw Grid commands and define your own layout where to place the different graphical objects, but it's more work.

Hope this helps,

baptiste


On 26 Apr 2009, at 01:31, Christian Bustamante wrote:

Hi all,
I'm trying to do multiple graphs in a window like this:

       ___  ___   ___
ylab  |__|  |__|   |__|
       ___  ___   ___
ylab  |__|  |__|   |__|
       ___  ___   ___
ylab  |__|  |__|   |__|
        xl     xl     xl

If I try to put the labels manually, some graphs become smaller than
other and the output is really ugly.
In the thread title I put the word "conditional" because I'm trying to
do a function, and in that function I want to print ylabels if the
plot positions is at first column of the graph matrix, and xlab if the
position is at last row of matrix.

How can i achive this two things?

Thanks for your help

--
CdeB

______________________________________________
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.

_____________________________

Baptiste AuguiƩ

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

______________________________________________
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.

Reply via email to