[R] Lattice equivalent of par(mfrow = )

jim holtman jholtman at gmail.com
Sun Jan 13 15:44:51 CET 2008


You need to make sure all your xlab's are the same size.  Try:

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(atop(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))



On Jan 13, 2008 7:40 AM, Michael Kubovy <kubovy at virginia.edu> wrote:
> 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/
>
> ______________________________________________
> R-help at 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?




More information about the R-help mailing list