pie                   package:base                   R Documentation

_P_i_e _C_h_a_r_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Draw a pie chart.

_U_s_a_g_e:

     pie(x, labels = names(x), edges = 200, radius = 0.8,
         density = NULL, angle = 45, col = NULL,
         main = NULL, ...)

_A_r_g_u_m_e_n_t_s:

       x: a vector of positive quantities. The values in `x' are
          displayed as the areas of pie slices.

  labels: a vector of character strings giving names for the slices.

   edges: the circular outline of the pie is approximated by a polygon
          with this many edges.

  radius: the pie is drawn centered in a square box whose sides range
          from -1 to 1.  If the character strings labeling the slices
          are long it may be necessary to use a smaller radius.

 density: the density of shading lines, in lines per inch. The default
          value of `NULL' means that no shading lines are drawn.
          Non-positive values of `density' also inhibit the drawing of
          shading lines.

   angle: the slope of shading lines, given as an angle in degrees
          (counter-clockwise).

     col: a vector of colors to be used in filling or shading the
          slices. If missing a set of 6 pastel colours is used, unless
          `density' is specified when `par("fg")' is used.

    main: an overall title for the plot.

     ...: graphical parameters can be given as arguments to `pie'.

_N_o_t_e:

     Pie charts are a very bad way of displaying information. The eye
     is good at judging linear measures and bad at judging relative
     areas.

     A bar chart or dot chart is a preferable way of displaying this
     type of data.

     Prior to R 1.5.0 this was known as `piechart', which is the name
     of a Trellis function, so the name was changed to be compatible
     with S.

_S_e_e _A_l_s_o:

     `dotchart'.

_E_x_a_m_p_l_e_s:

     pie(rep(1, 24), col = rainbow(24), radius = 0.9)

     pie.sales <- c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12)
     names(pie.sales) <- c("Blueberry", "Cherry",
         "Apple", "Boston Cream", "Other", "Vanilla Cream")
     pie(pie.sales) # default colours
     pie(pie.sales,
         col = c("purple", "violetred1", "green3", "cornsilk", "cyan", "white"))
     pie(pie.sales, col = gray(seq(0.4,1.0,length=6)))
     pie(pie.sales, density = 10, angle = 15 + 10 * 1:6)

