scatterHatch: Creates a scatterplot with hatched patterns.

View source: R/scatterHatch.R

scatterHatchR Documentation

Creates a scatterplot with hatched patterns.

Description

This function creates a scatterplot with hatched patterns by using geom_segment(). Also creates the legend to represent each hatched group. The aesthetics defining each pattern, like the lineType and lineColor are all passed to geom_segment().

Usage

scatterHatch(
  data,
  x,
  y,
  color_by,
  legendTitle = "",
  pointSize = 1,
  pointAlpha = 0.5,
  gridSize = NULL,
  sparsePoints = NULL,
  patternList = NULL,
  colorPalette = NULL
)

Arguments

data

Dataset to be used

x

Column name of x-coordinates

y

Column name of y-coordinates

color_by

Column name of factor that defines groupings

legendTitle

Title of the legend

pointSize

Point size for the scatterplot

pointAlpha

Transparency of points in the scatterplot

gridSize

Controls the precision of the hatched pattern. Larger values correspond to greater precision. Default follows a exponential decay function based on point size.

sparsePoints

Logical Vector denoting points annotated as sparse. If NULL, default sparsity detector will be used to annotate sparse points.

patternList

Aesthetics to be passed for each pattern (must be a list where each element has a named pattern)

colorPalette

Colors to be used for each group. Default is color-blind friendly.

Value

ggplot2 object of scatterplot with hatched patterns for each group.

Examples

data(pdacData)
scatterHatch(pdacData, "Xt", "Yt", "frame")

FertigLab/scatterHatch documentation built on July 13, 2022, 9:23 p.m.