Skip to content

plot a list of trellis objects

10 messages · Jeff Newmiller, Frede Aakmann Tøgersen, Santosh +1 more

#
What in the world is so horrible about for loops?
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
On February 17, 2014 4:41:13 PM PST, Santosh <santosh2005 at gmail.com> wrote:
#
How about


lattice.plots <- list(xyplot(rnorm(10) ~ 1:10, type = "b"),
                                     xyplot(rnorm(10) ~ 1:10, type = "b"),
                                     xyplot(rnorm(10) ~ 1:10, type = "b"),
                                    xyplot(rnorm(10) ~ 1:10, type = "b"))

do.call(grid.arrange, lattice.plots)

There is most likely a loop hidden somewhere in the do.call function ;-)


Yours sincerely / Med venlig hilsen


Frede Aakmann T?gersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
frtog at vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender.
#
Hi Santosh

for more control on size and position

?lattice::print.trellis

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Santosh
Sent: Tuesday, 18 February 2014 10:41
To: r-help
Subject: [R] plot a list of trellis objects

Dear Rxperts

Is there a way to control the display order (or simplistically control
panel layout) of a list of trellis objects without using a for loop (or
whatever)?

I just realize that gridExtra has that feature.. (grid.arrange)...

But, converting each of those elements of the list of trellis objects into
an argument to grid.arrange seems to negate the simplicity.. In addition,
if I were to use grid.arrange on a list of trellis objects, is there a way
to pass the list elements as arguments to grid.arrange?

If you have other suggestions, please do..

Regards,
Santosh


______________________________________________
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.
#
Well to be in control:

Please read carefully the help to grid.layout

Create a Grid Layout

Description:

     This function returns a Grid layout, which describes a subdivision
     of a rectangular region.

Usage:

     grid.layout(nrow = 1, ncol = 1,
             widths = unit(rep(1, ncol), "null"),
             heights = unit(rep(1, nrow), "null"),
             default.units = "null", respect = FALSE,
             just="centre")

to control your settings more carefully.     

Please read the help to lattice::print

C_05_print.trellis           package:lattice           R Documentation

Plot and Summarize Trellis Objects

Description:

     The 'print' and 'plot' methods produce a graph from a '"trellis"'
     object.  The 'print' method is necessary for automatic plotting.
     'plot' method is essentially an alias, provided for convenience.
     The 'summary' method gives a textual summary of the object.  'dim'
     and 'dimnames' describe the cross-tabulation induced by
     conditioning.  'panel.error' is the default handler used when an
     error occurs while executing the panel function.

Usage:

     ## S3 method for class 'trellis'
     plot(x, position, split,
          more = FALSE, newpage = TRUE,
          packet.panel = packet.panel.default, 
          draw.in = NULL,
          panel.height = lattice.getOption("layout.heights")$panel,
          panel.width = lattice.getOption("layout.widths")$panel,
          save.object = lattice.getOption("save.object"),
          panel.error = lattice.getOption("panel.error"),
          prefix,
          ...)


To be in superior control.

Happy plotting.




Yours sincerely / Med venlig hilsen


Frede Aakmann T?gersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
frtog at vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender.
#
Hi

for print.trellis you could make a function and supply the plots as
arguments ?list and then print them
There are various ways of doing it and you could have a matrix as an
argument with the proportions and access them

Regards

Duncan

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Santosh
Sent: Wednesday, 19 February 2014 06:12
Cc: r-help
Subject: Re: [R] plot a list of trellis objects

I forgot to add.. printltrellis seems to take in only one trellis object at
a time.. so.. I think I would need to use a loop for varying the column/row
indices, etc...

Is that the only way (other than grid.arrange)? Is column/row/page control
possible through grid.arrange..?
On Tue, Feb 18, 2014 at 11:59 AM, Santosh <santosh2005 at gmail.com> wrote:

            
"b"),
"b"),