balloonplot              package:gplots              R Documentation

_P_l_o_t _a _g_r_a_p_h_i_c_a_l _m_a_t_r_i_x _w_h_e_r_e _e_a_c_h _c_e_l_l _c_o_n_t_a_i_n_s _a _d_o_t _w_h_o_s_e _s_i_z_e
_r_e_f_l_e_c_t_s _t_h_e _r_e_l_a_t_i_v_e _m_a_g_n_i_t_u_d_e _o_f _t_h_e _c_o_r_r_e_s_p_o_n_d_i_n_g _c_o_m_p_o_n_e_n_t.

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

     Plot a graphical matrix where each cell contains a dot whose size
     reflects the relative magnitude of the corresponding component.

_U_s_a_g_e:

     balloonplot(x, ...)
     ## S3 method for class 'table':
     balloonplot(x, xlab, ylab, zlab, ...)
     ## Default S3 method:
     balloonplot(x, y, z,
         xlab = deparse(substitute(x)),
         ylab = deparse(substitute(y)), 
         zlab = deparse(substitute(z)),
         dotsize = 2/max(strwidth(19), strheight(19)),
         dotchar = 19, dotcolor = "skyblue",
         main, label = TRUE, label.digits = 2,
         scale.method = c("volume", "diameter"),
         colsrt = par("srt"),
         rowsrt = par("srt"),
         colmar = 1,
         rowmar = 1,
          ...) 

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

       x: Either a table object, or a vector of values for the first
          (x) dimension of the plotted matrix.

       y: Vector of values for the second (y) dimension of the plotted
          matrix.

       z: Vector of values for the size of the dots in the plotted
          matrix.

    xlab: Text label for the x dimension. This will be displayed on the
          x axis and in the plot title.

    ylab: Text label for the y dimension. This will be displayed on the
          y axis and in the plot title.

    zlab: Text label for the dot size. This will be included in the
          plot title.

 dotsize: Maximum dot size.  You may need to adjust this value for
          different plot devices and layouts.

 dotchar: Plotting symbol or character used for dots.  See the help
          page for the points function for symbol codes.

dotcolor: Scalar or vector specifying the color(s) of the dots in the
          plot.

    main: Plot title text.

   label: Boolean flag indicating whether the actual value of the
          elements should be shown on the plot.

label.digits: Number of digits used in formatting value labels.

scale.method: Method of scaling the sizes of the dot, either "volume"
          or "diameter". See below.

rowsrt, colsrt: Angle of rotation for row and column labels.

rowmar, colmar: Space allocated for row and column labels. Each unit is
          the width/height of one cell in the table.

     ...: Additional arguments passed to 'balloonplot.default' or
          'plot', as appropriate.

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

     This function plots a visual matrix.  In each 'x','y' cell a dot
     is plotted which reflects the relative size of the corresponding
     value of 'z'.  When 'scale.method="volume"' the volume of the dot
     is proportional to the relative size of 'z'.  When
     'scale.method="diameter"', the diameter of the dot is proportional
     to the the relative size of 'z'.  The "volume" method is default
     because the "diameter" method visually exaggerates differences.

_V_a_l_u_e:

     Nothing of interest.

_N_o_t_e:

     'z' is expected to be non-negative.  The function will still
     operate correctly if there are negative values of 'z', but the
     corresponding dots will have 0 size and a warning will be
     generated.

_A_u_t_h_o_r(_s):

     Gregory R. Warnes Gregory_R_Warnes@groton.pfizer.com

_R_e_f_e_r_e_n_c_e_s:

     Function inspired by question posed on R-help by Ramon
     Alonso-Allende allende@cnb.uam.es.

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

     'plot.table'

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

     # Create an Example Data Frame Containing Car x Color data
     carnames <- c("bmw","renault","mercedes","seat")
     carcolors <- c("red","white","silver","green")
     datavals <- round(rnorm(16, mean=100, sd=60),1)
     data <- data.frame(Car=rep(carnames,4),
                        Color=rep(carcolors, c(4,4,4,4) ),
                        Value=datavals )
     # show the data
     data

     # generate balloon plot with default scaling
     balloonplot( data$Car, data$Color, data$Value)

     # show margin label rotation & space expansion, using some long labels
     levels(data$Car) <- c("BMW: High End, German","Renault: Medium End, French",
      "Mercedes: High End, German", "Seat: Imaginary, Unknown Producer")

     # generate balloon plot with default scaling
     balloonplot( data$Car, data$Color, data$Value, colmar=3, colsrt=90)

     # Create an example using table
     xnames <- sample( letters[1:3], 50, replace=2)
     ynames <- sample( 1:5, 50, replace=2)

     tab <- table(xnames, ynames)

     balloonplot(tab)

