symbols               package:graphics               R Documentation

_D_r_a_w _S_y_m_b_o_l_s (_C_i_r_c_l_e_s, _S_q_u_a_r_e_s, _S_t_a_r_s, _T_h_e_r_m_o_m_e_t_e_r_s, _B_o_x_p_l_o_t_s) _o_n _a _P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     This function draws symbols on a plot.  One of six symbols;
     _circles_, _squares_, _rectangles_, _stars_, _thermometers_, and
     _boxplots_, can be plotted at a specified set of x and y
     coordinates.  Specific aspects of the symbols, such as relative
     size, can be customized by additional parameters.

_U_s_a_g_e:

     symbols(x, y = NULL, circles, squares, rectangles, stars,
             thermometers, boxplots, inches = TRUE, add = FALSE,
             fg = 1, bg = NA, xlab = NULL, ylab = NULL, main = NULL,
             xlim = NULL, ylim = NULL, ...)

_A_r_g_u_m_e_n_t_s:

    x, y: the x and y co-ordinates for the symbols. They can be
          specified in any way which is accepted by 'xy.coords'.

 circles: a vector giving the radii of the circles.

 squares: a vector giving the length of the sides of the squares.

rectangles: a matrix with two columns.  The first column gives widths
          and the second the heights of rectangle symbols.

   stars: a matrix with three or more columns giving the lengths of the
          rays from the center of the stars.  'NA' values are replaced
          by zeroes.

thermometers: a matrix with three or four columns.  The first two
          columns give the width and height of the thermometer symbols.
          If there are three columns, the third is taken as a
          proportion. The thermometers are filled from their base to
          this proportion of their height.  If there are four columns,
          the third and fourth columns are taken as proportions.  The
          thermometers are filled between these two proportions of
          their heights.

boxplots: a matrix with five columns.  The first two columns give the
          width and height of the boxes, the next two columns give the
          lengths of the lower and upper whiskers and the fifth the
          proportion (with a warning if not in [0,1]) of the way up the
          box that the median line is drawn.

  inches: If 'inches' is 'FALSE', the units are taken to be those of
          the x axis.  If 'inches' is 'TRUE', the symbols are scaled so
          that the largest symbol is one inch in height.  If a number
          is given the symbols are scaled to make largest symbol this
          height in inches.

     add: if 'add' is 'TRUE', the symbols are added to an existing
          plot, otherwise a new plot is created.

      fg: colors the symbols are to be drawn in (the default is the
          value of the 'col' graphics parameter).

      bg: if specified, the symbols are filled with this color. The
          default is to leave the symbols unfilled. 

    xlab: the x label of the plot if 'add' is not true; this applies to
          the following arguments as well.  Defaults to the 'deparse'd
          expression used for 'x'.

    ylab: the y label of the plot.

    main: a main title for the plot.

    xlim: numeric of length 2 giving the x limits for the plot.

    ylim: numeric of length 2 giving the y limits for the plot.

     ...: graphics parameters can also be passed to this function, as
          can the plot aspect ratio 'asp' (see 'plot.window').

_D_e_t_a_i_l_s:

     Observations which have missing coordinates or missing size
     parameters are not plotted.  The exception to this is _stars_. In
     that case, the length of any rays which are 'NA' is reset to zero.

     Circles of radius zero are plotted at radius one pixel (which is
     device-dependent).

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

     W. S. Cleveland (1985) _The Elements of Graphing Data._ Monterey,
     California: Wadsworth.

_S_e_e _A_l_s_o:

     'stars' for drawing _stars_ with a bit more flexibility;
     'sunflowerplot'.

_E_x_a_m_p_l_e_s:

     x <- 1:10
     y <- sort(10*runif(10))
     z <- runif(10)
     z3 <- cbind(z, 2*runif(10), runif(10))
     symbols(x, y, thermometers=cbind(.5, 1, z), inches=.5, fg = 1:10)
     symbols(x, y, thermometers = z3, inches=FALSE)
     text(x,y, apply(format(round(z3, dig=2)), 1, paste, collapse = ","),
          adj = c(-.2,0), cex = .75, col = "purple", xpd=NA)

     ## Note that  example(trees)  shows more sensible plots!
     N <- nrow(trees)
     attach(trees)
     ## Girth is diameter in inches
     symbols(Height, Volume, circles=Girth/24, inches=FALSE,
             main="Trees' Girth")# xlab and ylab automatically
     ## Colors too:
     palette(rainbow(N, end = 0.9))
     symbols(Height, Volume, circles=Girth/16, inches=FALSE, bg = 1:N,
             fg="gray30", main="symbols(*, circles=Girth/16, bg = 1:N)")
     palette("default"); detach()

