Skip to contents

Produce single scatter plot with data frame passed from upstream

Usage

.ggScatter(
  plotDF,
  x,
  y,
  colorBy = NULL,
  shapeBy = NULL,
  dotOrder = c("shuffle", "ascending", "descending"),
  dotSize = getOption("ligerDotSize"),
  dotAlpha = 0.9,
  trimHigh = NULL,
  trimLow = NULL,
  zeroAsNA = TRUE,
  raster = NULL,
  labelBy = colorBy,
  labelText = TRUE,
  labelTextSize = 4,
  ggrepelLabelTick = FALSE,
  seed = 1,
  ...
)

Arguments

plotDF

Data frame like object (fortifiable) that contains all necessary information to make the plot.

x, y

Available variable name in cellMeta slot to look for the dot coordinates. See details.

colorBy, shapeBy

See plotDimRed.

dotOrder

Controls the order that each dot is added to the plot. Choose from "shuffle", "ascending", or "descending". Default "shuffle", useful when coloring by categories that overlaps (e.g. "dataset"), "ascending" can be useful when coloring by a continuous variable (e.g. gene expression) where high values needs more highlight. NULL use default order.

dotSize, dotAlpha

Numeric, controls the size or transparency of all dots. Default getOption("ligerDotSize") (1) and 0.9.

trimHigh, trimLow

Numeric, limit the largest or smallest value of continuous colorBy variable. Default NULL.

zeroAsNA

Logical, whether to set zero values in continuous colorBy variable to NA so the color of these value.

raster

Logical, whether to rasterize the plot. Default NULL automatically rasterize the plot when number of total dots to be plotted exceeds 100,000.

labelBy

A variable name available in plotDF. If the variable is categorical (a factor), the label position will be the median coordinates of all dots within the same group. Unique labeling in character vector for each dot is also acceptable. Default colorBy.

labelText

Logical, whether to show text label at the median position of each categorical group specified by colorBy. Default TRUE. Does not work when continuous coloring is specified.

labelTextSize

Numeric, controls the size of label size when labelText = TRUE. Default 4.

ggrepelLabelTick

Logical, whether to force showing the tick between label texts and the position they point to. Useful when a lot of text labels are required. Default FALSE. Run options(ggrepel.max.overlaps = n) before plotting to set allowed label overlaps.

seed

Random seed for reproducibility. Default 1.

...

More theme setting arguments passed to .ggplotLigerTheme.

Value

ggplot object by default. When plotly = TRUE, returns plotly (htmlwidget) object.

Details

Having package "ggrepel" installed can help adding tidier text labels on the scatter plot.