gpar                  package:grid                  R Documentation

_F_u_n_c_t_i_o_n _t_o _p_r_o_d_u_c_e _a _G_r_a_p_h_i_c_a_l _P_a_r_a_m_e_t_e_r _O_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     This function returns an object of class '"gpar"'.  This is
     basically a list of name-value pairs.

_U_s_a_g_e:

     gpar(...)

_A_r_g_u_m_e_n_t_s:

     ...: Any number of named arguments. 

_D_e_t_a_i_l_s:

     All grid viewports and (predefined) graphical objects have a slot
     called 'gp', which contains a '"gpar"' object.  When a viewport is
     pushed onto the viewport stack and when a graphical object is
     drawn, the settings in the '"gpar"' object are enforced. In this
     way, the graphical output is modified by the 'gp' settings until
     the graphical object has finished drawing, or until the viewport
     is popped off the viewport stack, or until some other viewport or
     graphical object is pushed or begins drawing.

     Valid parameter names are:

       col         Colour for lines and borders.
       fill        Colour for filling rectangles, polygons, ...
       lty         Line type
       lwd         Line width
       fontsize    The size of text (in points)
       fontfamily  The font family
       fontface    The font face (bold, italic, ...)
       lineheight  The height of a line as a multiple of fontsize
       font        Font face (alias for fontface;  for backward compatibility)

     For most devices, the 'fontfamily' is specified when the device is
     first opened and may not be changed thereafter - i.e., specifying
     a different font family via 'fontfamily' will be ignored.  This
     will hopefully change in future versions of R.  Also, there is an
     important exception:  'fontfamily' may be used to specify one of
     the Hershey Font families (e.g., 'HersheySerif') and this
     specification will be honoured on all devices.

     The specification of 'fontface' follows the R base graphics
     standard:  1 = plain, 2 = bold, 3 = italic, 4 = bold italic.

     Specifying the value 'NULL' for a parameter is the same as not
     specifying any value for that parameter, except for 'col' and
     'fill', where 'NULL' indicates not to draw a border or not to fill
     an area (respectively).

     All parameter values can be vectors of multiple values.  (This
     will not always make sense - for example, viewports will only take
     notice of the first parameter value.)

_V_a_l_u_e:

     An object of class '"gpar"'.

_A_u_t_h_o_r(_s):

     Paul Murrell

_S_e_e _A_l_s_o:

     'Hershey'.

_E_x_a_m_p_l_e_s:

     gpar(col = "red")
     gpar(col = "blue", lty = "solid", lwd = 3, fontsize = 16)
     grid.newpage()
     vp <- viewport(w = .8, h = .8, gp = gpar(col="blue"))
     grid.collection(grid.rect(gp = gpar(col="red"), draw = FALSE),
                     grid.text(paste("The rect is its own colour (red)",
                                     "but this text is the colour",
                                     "set by the collection (green)", sep = "\n"),
                               draw = FALSE),
                     gp = gpar(col="green"), vp = vp)
     grid.text("This text is the colour set by the viewport (blue)",
               y = 1, just = c("center", "bottom"),
               gp = gpar(fontsize=20), vp = vp)
     grid.newpage()
     ## example with multiple values for a parameter
     push.viewport(viewport())
     grid.points(1:10/11, 1:10/11, gp = gpar(col=1:10))
     pop.viewport()

