legend.CSP             package:rflowcyt             R Documentation

_M_a_k_e_s _a _r_o_u_g_h _l_e_g_e_n_d _f_o_r _t_h_e _C_o_n_t_o_u_r_S_c_a_t_t_e_r_P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     The color scheme used for the image plot within the
     ContourScatterPlot is scaled according the rough estimates of the
     breaks.  Any white-colored cells in an image or ContourScatterPlot
     is considered to be NA.

_U_s_a_g_e:

     legend.CSP(z, n,
        border = if (n < 32) "light gray" else NA,
        main = paste("color palettes;  n=", n),
        ch.col = c("rainbow(n, start=.7, end=.1)",
                 "heat.colors(n)", "terrain.colors(n)",
                 "topo.colors(n)", "cm.colors(n)"),
                 breaks = seq(range(z, na.rm = TRUE)[1],
                       range(z, na.rm = TRUE)[2],
                       by = diff(range(z, na.rm = TRUE))/n))

_A_r_g_u_m_e_n_t_s:

       z: The matrix grid used for the image plot; this matrix is
          produced via make.grid or make.density 

       n: The number of color levels

  border: The border of the legend plot

    main: The main title of the legend plot

  ch.col: the color palette used 

  breaks: the breaks used to scale the color scheme

_D_e_t_a_i_l_s:

     This legend is used as a rough approximation and is produced in a
     plot entirely separate.

_V_a_l_u_e:

     Plot of the color scheme scaled by ranges of the values of the
     grid cells in the image plot produced by 'z' input.

_A_u_t_h_o_r(_s):

     A.J. Rossini and J.Y. Wan

_R_e_f_e_r_e_n_c_e_s:

     The code was obtained from the example of heat.colors

_S_e_e _A_l_s_o:

     'heat.colors', 'ContourScatterPlot', 'image'

_E_x_a_m_p_l_e_s:

       if (require(rfcdmin)){
        data.there<-is.element(c("st.1829", "unst.1829", "st.DRT", "unst.DRT"),objects())
        if ( ( sum(data.there) != length(data.there) )){
           ## obtaining the FCS objects from VRC data
           data(VRCmin)
       }

     var1<-st.DRT@data[,4]
     var2<-st.DRT@data[,5]

     col.nm<-colnames(st.DRT@data)

     ## matrix of counts
     count.output1<-make.grid(var1, var2)
     mat.counts1<-count.output1$z
     if (interactive()){
     par(mfrow=c(2,2))

     image(mat.counts1,
       main="make.grid: Counts for stimulated",
        xlab=col.nm[4],yaxt="n", xaxt="n",
        ylab=col.nm[5], col=heat.colors(20))

     ## legend describes the counts in each cell
     legend.CSP(mat.counts1, 20, ch.col="heat.colors(n)")

     image(mat.counts1,yaxt="n", xaxt="n",
       main="make.grid: Counts for stimulated",
        xlab=col.nm[4],
        ylab=col.nm[5], col=topo.colors(20))

     legend.CSP(mat.counts1, 20, ch.col="topo.colors(n)")

     }

     }

