plt                 package:cwhplot                 R Documentation

_P_l_o_t _d_e_p_e_n_d_i_n_g _o_n _s_w_i_t_c_h, _C_r_e_a_t_e _m_u_l_t_i_p_l_e _p_l_o_t_s _w_i_t_h _t_i_t_l_e _a_n_d _t_i_m_e _s_t_a_m_p

_D_e_s_c_r_i_p_t_i_o_n:

     - 'plt' executes a (series of) plotting function(s) depending on a
     switch, may be useful in 'source'. - 'plotTitStamp' creates an
     array of plot panels and executes a (series of) plotting
     function(s) and adds a title and a time stamp to the overall plot.
     - 'pltTSV' is a shortcut for
     'plt(VIEW,plotTitStamp(...),file,horizontal)' - 'pltCharMat' uses
     output from 'charMat' to plot numerical matrices as characters

_U_s_a_g_e:

     plt(VIEW,f,file="",horizontal = FALSE)
     plotTitStamp(rows, cols, tit, stampl, f=function(x) 0,
           cex=1.5,reset=TRUE,outer=TRUE,oma=c(2,2,4,2),mar=c(4,4,2,1))
     pltTSV(VIEW="see", rows, cols, tit, stampl, f=function(x) 0,
           cex=1.5,reset=TRUE,outer=TRUE,oma=c(2,2,4,2),mar=c(4,4,2,1),
           file=stampl,horizontal=TRUE)
     pltCharMat(m,tit)

_A_r_g_u_m_e_n_t_s:

    VIEW: "NA" or NA, nothing will be done. "see", the plot will be
          created in the active plot window. "eps", the plot will be
          saved to file "<file>.eps" "ps",  the plot will be created in
          a postscript file "<file>.ps". "ps+p", like with "ps", the
          file will also be printed. "pdf", the plot will be created in
          a pdf file "<file>.pdf"

       f: A function to plot the individual plot panels. It can also be
          a statement sequence {...}

    file: Name of file to write to.

horizontal: Landscape, if TRUE.

    rows: Number of rows of panels.

    cols: Number of columns of panels.

     tit: Overall title for plot. A vector of one or two elements. If
          an element is an 'expression', 'plotmath' will be used

  stampl: Label for time stamp.

     cex: Font size used for 'tit'.

   reset: Should previous 'rows, cols' be restored after execution.

   outer: Passed on to mtext.

     oma: Outer margin used in initial par(...).

     mar: Lines of margin used in initial par(...).

       m: numerical matrix

_V_a_l_u_e:

     Are called for their side effect to produce a plot and/or generate
     a file.

_W_A_R_N_I_N_G:

     The sequence of functions contained in f MUST NOT contain any call
     to 'postscript', because this would try to open another ps device
     without closing the old one!

_N_o_t_e:

     oldpar <- par(mfrow = c(rows, cols),oma=oma,mar=mar) is called at
     the beginning of pltTitStamp. Uses 'datetime,
     [lattice:extend.limits]{extend.limits}'.

     If you have 'n' panels you want to plot in a nearly quadratic
     arrangement, use 'rows = round(sqrt(n)), cols=ceiling(n/rows)'
     (tending to slightly "landscape").  This is very similar to
     'n2mfrow'.

_A_u_t_h_o_r(_s):

     Christian W. Hoffmann, christian.hoffmann@wsl.ch, <URL:
     http://www.wsl.ch/staff/christian.hoffmann>

_E_x_a_m_p_l_e_s:

      # see also this-is-escaped-code{
     x <- rnorm(100); y <- rnorm(100)+1; z <- y+rlnorm(100)
     plt("see", {plot(x,y,xlab="this is my x");abline(reg=lm(y~x),lty=2);plot(x,z,pch=3)})
     ## Not run: plt("ps", plot(y,x-3*y) )
     ## Not run: plt("ps+p", plot(y,x-3*y) )
     ## Not run: 
     plotTitStamp(1, 2, "1 by 2 plot", "Example 1", {plot(x,y,xlab="my x");
       abline(reg=lm(y~x),lty=2);plot(x,z,pch=3)})
     ## End(Not run)
     ## Not run: plotTitStamp(1, 1, "1 by 2 plot", "Ex2", plot(y,x-3*y) )
       m <- matrix(rnorm(500),nrow=50,ncol=10)
       pltCharMat(m,"Random example")

