plot.histogram           package:graphics           R Documentation

_P_l_o_t _H_i_s_t_o_g_r_a_m_s

_D_e_s_c_r_i_p_t_i_o_n:

     These are methods for objects of class '"histogram"', typically
     produced by 'hist'.

_U_s_a_g_e:

     ## S3 method for class 'histogram':
     plot(x, freq = equidist, density = NULL, angle = 45,
                    col = NULL, border = par("fg"), lty = NULL,
                    main = paste("Histogram of",
                                 paste(x$xname, collapse="\n")),
                    sub = NULL, xlab = x$xname, ylab,
                    xlim = range(x$breaks), ylim = NULL,
                    axes = TRUE, labels = FALSE, add = FALSE, ann = TRUE, ...)

     ## S3 method for class 'histogram':
     lines(x, ...)

_A_r_g_u_m_e_n_t_s:

       x: a 'histogram' object, or a list with components 'density',
          'mid', etc, see 'hist' for information about the components
          of 'x'.

    freq: logical; if 'TRUE', the histogram graphic is to present a
          representation of frequencies, i.e, 'x$counts'; if 'FALSE',
          _relative_ frequencies (probabilities), i.e., 'x$density',
          are plotted.  The default is true for equidistant 'breaks'
          and false otherwise.

     col: a colour to be used to fill the bars.  The default of 'NULL'
          yields unfilled bars.

  border: the color of the border around the bars.

angle, density: select shading of bars by lines: see 'rect'.

     lty: the line type used for the bars, see also 'lines'.

main, sub, xlab, ylab: these arguments to 'title' have useful defaults
          here.

xlim, ylim: the range of x and y values with sensible defaults.

    axes: logical, indicating if axes should be drawn.

  labels: logical or character.  Additionally draw labels on top of
          bars, if not 'FALSE'; if 'TRUE', draw the counts or rounded
          densities; if 'labels' is a 'character', draw itself.

     add: logical.  If 'TRUE', only the bars are added to the current
          plot.  This is what 'lines.histogram(*)' does.

     ann: logical.  Should annotations (titles and axis titles) be
          plotted?

     ...: further graphical parameters to 'title' and 'axis'.

_D_e_t_a_i_l_s:

     'lines.histogram(*)' is the same as 'plot.histogram(*, add =
     TRUE)'.

_S_e_e _A_l_s_o:

     'hist', 'stem', 'density'.

_E_x_a_m_p_l_e_s:

     (wwt <- hist(women$weight, nclass = 7, plot = FALSE))
     plot(wwt, labels = TRUE) # default main & xlab using wwt$xname
     plot(wwt, border = "dark blue", col = "light blue",
          main = "Histogram of 15 women's weights", xlab = "weight [pounds]")

     ## Fake "lines" example, using non-default labels:
     w2 <- wwt; w2$counts <- w2$counts - 1
     lines(w2, col = "Midnight Blue", labels = ifelse(w2$counts, "> 1", "1"))

