plotCellMiner2D {rcellminer} | R Documentation

## Make a simple 2d plot using two variables with ggplot2

### Description

Make a simple 2d plot using two variables with ggplot2

### Usage

    plotCellMiner2D(
      df,
      xCol = "x",
      yCol = "y",
      xLabel = xCol,
      yLabel = yCol,
      title = NULL,
      colorPalette = NULL,
      classCol = NULL,
      tooltipCol = NULL,
      showLegend = FALSE,
      showTrendLine = TRUE,
      showTitle = TRUE,
      singleColor = "#0000FF",
      alpha = 1,
      numberColPrefix = "X",
      xLimVal = NULL,
      yLimVal = NULL,
      pointSize = 3
    )

### Arguments

`df` | a data.frame with at least two columns
`xCol` | the name of the column in df with the "x" data. See Note
`yCol` | the name of the column in df with the "y" data. See Note
`xLabel` | the x plot label
`yLabel` | the y plot label
`title` | the plot title, if null the correlation will appear (DEFAULT: NULL)
`colorPalette` | a named vector with the names classes and value colors (DEFAULT: NULL)
`classCol` | the name of the column with the classes. Values in column of df must be a factor (DEFAULT: NULL)
`tooltipCol` | the name of the column used for tooltips when plotted with plotly
`showLegend` | boolean, whether to show the legend (DEFAULT: FALSE)
`showTrendLine` | boolean, whether to show the trendline
`showTitle` | boolean, whether to show the title
`singleColor` | a color to be used for all points when a color palette is not provided (DEFAULT: blue)
`alpha` | value from 0-1, where 0 indicates transparent points (DEFAULT: 1, not transparent)
`numberColPrefix` | a prefix to add to column names that start with a number that causes issues with ggplot (DEFAULT: X)
`xLimVal` | a two entry vector (min, max) to set the x-axis
`yLimVal` | a two entry vector (min, max) to set the y-axis
`pointSize` | size of points on plot (DEFAULT: 3)

### Value

a ggplot object

### Note

TROUBLESHOOTING NOTES: 1) Avoid ":" in colnames

Uses ggplot aes_string() which uses parse() to turn your text expression into a proper R symbol that can be resolved within the data.frame. Avoid numbers and spaces in

### Author(s)

Augustin Luna <augustin AT mail.nih.gov>

### Examples

    ## Not run:
    # Load data
    nci60DrugActZ <- exprs(getAct(rcellminerData::drugData))
    nci60GeneExpZ <- getAllFeatureData(rcellminerData::molData)[["exp"]]
    # Load colors
    colorTab <- loadNciColorSet(returnDf=TRUE)
    tissueColorTab <- unique(colorTab[, c("tissues", "colors")])
    # Merge data
    df <- as.data.frame(t(rbind(nci60DrugActZ["94600",], nci60GeneExpZ["SLFN11",])))
    colnames(df) <- c("y", "x")
    df <- cbind(df, colorTab)
    # Plot data
    plotCellMiner2D(df, xCol="x", yCol="y", xLabel="SLFN11", yLabel="94600")
    plotCellMiner2D(df, xCol="x", yCol="y", showTrendLine = FALSE, showTitle = FALSE)
    plotCellMiner2D(df, xCol="x", yCol="y", showTrendLine = FALSE, showLegend = FALSE)

    ## End(Not run)

[Package rcellminer version 2.10.2 Index]