

screen {base}                                R Documentation

_C_r_e_a_t_i_n_g _a_n_d _C_o_n_t_r_o_l_l_i_n_g _M_u_l_t_i_p_l_e _S_c_r_e_e_n_s _o_n _a _S_i_n_g_l_e _D_e_v_i_c_e

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

     `split.screen' defines a number of regions within the
     current device which can, to some extent, be treated as
     separate graphics devices.  It is useful for generating
     multiple plots on a single device.  Screens can them-
     selves be split, allowing for quite complex arrange-
     ments of plots.

     `screen' is used to select which screen to draw in.

     `erase.screen' is used to clear a single screen.

     `close.screen' removes the specified screen defini-
     tion(s).

_U_s_a_g_e_:

     split.screen(figs, screen=<<see below>>, erase=T)
     screen(n=<<see below>>, new=T)
     erase.screen(n=<<see below>>)
     close.screen(n=<<see below>>, all=T)

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

    figs: A two-element vector describing the number of rows
          and the number of columns in a screen matrix or a
          matrix with 4 columns.  If a matrix, then each row
          describes a screen with values for the left,
          right, bottom, and top of the screen (in that
          order) in NDC units.

       n: A number indicating which screen to prepare for
          drawing (`screen'), erase (`erase.screen'), or
          close (`close.screen').

     new: A logical value indicating whether the screen
          should be erased as part of the preparation for
          drawing in the screen.

     all: A logical value indicating whether all of the
          screens should be closed.

_D_e_t_a_i_l_s_:

     The first call to `split.screen' places R into split-
     screen mode.  The other split-screen functions only
     work within this mode.  While in this mode, certain
     other commands should be avoided (see WARNINGS below).
     Split-screen mode is exited by the command
     `close.screen(all=T)'

_V_a_l_u_e_:

     `split.screen' returns a vector of screen numbers for
     the newly-created screens.  With no arguments,
     `split.screen' returns a vector of valid screen num-
     bers.

     `screen' invisibly returns the number of the selected
     screen.  With no arguments, `screen' returns the number
     of the current screen.

     `close.screen' returns a vector of valid screen num-
     bers.

     `screen', `erase.screen', and `close.screen' all return
     `FALSE' if R is not in split-screen mode.

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

     These functions are totally incompatible with the other
     mechanisms for arranging plots on a device:
     `par(mfrow)', `par(mfcol)', and `layout()'.

     The functions are also incompatible with some plotting
     functions, such as `coplot', which make use of these
     other mechanisms.

     The functions should not be used with multiple devices.

_S_e_e _A_l_s_o_:

     `par', `layout', `Devices', `dev.*'

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

     if (interactive()) {

     split.screen(c(2,1))             # split display into two screens
     split.screen(c(1,3), screen = 2) # now split the bottom half into 3
     screen(1) # prepare screen 1 for output
     plot(10:1)
     screen(4) # prepare screen 4 for output
     plot(10:1)
     close.screen(all = T) # exit split-screen mode

     split.screen(c(2,1))        # split display into two screens
     split.screen(c(1,2),2)      # split bottom half in two
     plot(1:10)                  # screen 3 is active, draw plot
     erase.screen()              #forgot label, erase and redraw
     plot(1:10, ylab= "ylab 3")
     screen(1)                 # prepare screen 1 for output
     plot(1:10)
     screen(4)                 # prepare screen 4 for output
     plot(1:10, ylab="ylab 4")
     screen(1, F)              #return to screen 1, but do not clear
     plot(10:1, axes=F, lty=2, ylab="")  # overlay second plot
     axis(4)                   # add tic marks to right-hand axis
     title("Plot 1")
     close.screen(all = T) # exit split-screen mode

     }

