Skip to content

Conditional plot labels

3 messages · Christian Bustamante, Baptiste Auguie, Greg Snow

#
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
#
Hi,

Have you considered using high-level plotting functions provided by  
the ggplot2 or lattice package? Here's a dummy example,
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:

            
_____________________________

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
4 days later
#
Here is one example that moves the axes to the outer margins, play with the different settings to see the effects:

par(oma=c(3,3,3,3)+.1, mar=c(0,0,0,0)+0.1, mfrow=c(3,3))

for (i in 1:9) {
	plot( runif(10*i), runif(10*i), ann=FALSE, xlim=c(0,1), ylim=c(0,1),
		 xaxt='n', yaxt='n' )
	if( i %% 3 == 1 ) axis(2, outer=TRUE)
	if( (i-1) %/% 3 == 2 ) axis(1, outer=TRUE)
}

Hope this helps,