legend.CSP {rflowcyt} | R Documentation

## Makes a rough legend for the ContourScatterPlot

### Description

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.

### Usage

    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))

### Arguments

`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

### Details

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

### Value

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

### Author(s)

A.J. Rossini and J.Y. Wan

### References

The code was obtained from the example of heat.colors

### See Also

`heat.colors`, `ContourScatterPlot`, `image`

### Examples

      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)")

    }

    }

[Package rflowcyt version 1.16.0 Index]