[R] Lattice equivalent of par(mfrow = )

Michael Kubovy kubovy at virginia.edu
Sun Jan 13 13:40:32 CET 2008


Dear R-helpers,

On Jan 12, 2008, at 5:17 PM, Deepayan Sarkar wrote:

> On 1/12/08, Michael Kubovy <kubovy at virginia.edu> wrote:
>> Dear r-helpers,
>>
>> Does anyone have a straightforward example of putting together three
>> unrelated (expect for a common y-axis) xyplot() figures in what would
>> be in base graphics a par(mfrow = c(1, 3)) arrangement?
>
> See the examples in ?print.trellis.

Thanks. Now how do I insure that the three y-axes are the same scale  
in the following?

states <- data.frame(state.x77,
                      state.name = dimnames(state.x77)[[1]],
                      state.region = state.region)
plot1 <- xyplot(Murder ~ Population, data = states,
	xlab = grid::textGrob(expression(frac(abs(bold(c)), abs(bold(b)))),  
gp=gpar(fontsize=25)),
	ylab = grid::textGrob(expression(paste(log, frac(italic(p) 
(italic(c)), italic(p)(italic(b))))), gp = gpar(fontsize = 25)),
)
plot2 <- xyplot(Murder ~ Population, data = states,
	xlab = grid::textGrob(expression(gamma), gp = gpar(fontsize= 25)),
	ylab = '',
)
plot3 <- xyplot(Murder ~ Population, data = states,
	xlab =  
grid::textGrob(expression(frac(abs( bold(c) ),abs( bold(b) ))), gp =  
gpar(fontsize = 25)),
	ylab = '',
)
print(plot1, position = c(0.0, 0, 0.33, 1), more = TRUE)
print(plot2, position = c(0.33, 0, 0.67, 1), more = TRUE)
print(plot3, position = c(0.67, 0, 1, 1))

_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/




More information about the R-help mailing list