smoothScatter             package:prada             R Documentation

_S_c_a_t_t_e_r_p_l_o_t_s _w_i_t_h _s_m_o_o_t_h_e_d _d_e_n_s_i_t_i_e_s _c_o_l_o_r _r_e_p_r_e_s_e_n_t_a_t_i_o_n

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

     'smmothScatter' produces a smoothed color density representation
     of the scatterplot, obtained through a kernel density estimate.
     'densCols' produces a vector containing colors which encode the
     local densities at each point in a scatterplot.

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

     smoothScatter(x, y,
                   nbin = 128,
                   bandwidth,
                   colramp = colorRampPalette(brewer.pal(9, "YlGnBu")),
                   nrpoints = 100,
                   transformation = function(x) x^.25,
                   xlab, ylab, ...) 

          densCols(x, y,
                   nbin = 128,
                   bandwidth,
                   colramp = colorRampPalette(brewer.pal(9, "YlGnBu")[-(1:3)]))

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

       x: Numeric vector containing x-values or n by 2 matrix
          containing x and y values.

       y: Numeric vector containing y-values (optional). The length of
          'x' must be the same as that of 'y'.

    nbin: Numeric vector of length 1 (for both directions) or 2 (for x
          and y separately) containing the number of equally spaced
          grid points for the density estimation.

bandwidth: Numeric vector: the smoothing bandwidth. If missing, these
          functions come up with a more or less useful guess. This
          parameter then gets passed on to function. 'bkde2D'.

 colramp: Function accepting an integer 'n' as an argument and
          returning 'n' colors.

nrpoints: Numeric vector of length 1 giving number of points to be
          superimposed on the density image. If all points are to be
          plotted, choose 'nrpoints = Inf'.

transformation: Function that maps the density scale to the color
          scale.

    xlab: Character. Gets passed on to 'image'

    ylab: Character. Gets passed on to 'image'

     ...: Further arguments that are passed on to 'image'.

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

     These functions are convenience wrappers around 'bkde2D'.

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

     'smoothScatter' is called for its side-effect, producing a plot on
     the current graphics device. 'densCols' returns a vector of length
     'nrow(x)' that contains colors to be used in a subsequent
     scatterplot. Each color represents the local density around the
     corresponding point.

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

     Florian Hahne <f.hahne@dkfz.de>

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

     'bkde2D'

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

     sampdat <- readFCS(system.file("extdata","fas Bcl2 plate323-04-04.A01",package="prada"))
     x       <- exprs(sampdat[,1:2])

     if(interactive()) {
       layout(matrix(1:4, ncol=2, byrow=TRUE))
       smoothScatter(x, nrpoints=0)
       smoothScatter(x)
       smoothScatter(x, nrpoints=Inf, colramp=colorRampPalette(brewer.pal(9, "YlOrRd")), bandwidth=40)  

       colors  <- densCols(x)
       plot(x, col=colors, pch=20)
     }

