draw: Visualize data

drawR Documentation

Visualize data

Description

The draw() function is humdrumR's goto plotting function. draw() can make a variety of graphs, depending on the type of data you give it. For the most part, draw() is simply a stylish, easy to use wrapper around the base-R graphics functions plot(), barplot(), and hist().

Usage

draw(
  x,
  y,
  col = 2,
  facet = list(),
  main = "",
  sub = "",
  xlab = NULL,
  ylab = NULL,
  ...
)

## S4 method for signature 'numeric,numeric'
draw(
  x,
  y,
  col = 3,
  log = "",
  jitter = "xy",
  xlim = NULL,
  ylim = NULL,
  xat = NULL,
  yat = NULL,
  cex = prep_cex(x),
  ...
)

## S4 method for signature 'numeric,missing'
draw(
  x,
  y,
  col = 3,
  breaks = "Sturges",
  jitter = "",
  ...,
  cex = prep_cex(x) * 0.75,
  xlim = NULL,
  ylim = NULL
)

## S4 method for signature 'missing,numeric'
draw(
  x,
  y,
  col = 3,
  log = "",
  jitter = "",
  ...,
  cex = prep_cex(y),
  yat = NULL,
  quantiles = c(0.025, 0.25, 0.5, 0.75, 0.975)
)

## S4 method for signature 'discrete,discrete'
draw(
  x,
  y,
  col = 2,
  facet = list(),
  main = "",
  sub = "",
  xlab = NULL,
  ylab = NULL,
  ...
)

## S4 method for signature 'discrete,missing'
draw(
  x,
  y,
  col = 2,
  facet = list(),
  main = "",
  sub = "",
  xlab = NULL,
  ylab = NULL,
  ...
)

## S4 method for signature 'token,missing'
draw(
  x,
  y,
  col = 2,
  facet = list(),
  main = "",
  sub = "",
  xlab = NULL,
  ylab = NULL,
  ...
)

## S4 method for signature 'missing,token'
draw(
  x,
  y,
  col = 2,
  facet = list(),
  main = "",
  sub = "",
  xlab = NULL,
  ylab = NULL,
  ...
)

## S4 method for signature 'token,token'
draw(
  x,
  y,
  col = 2,
  facet = list(),
  main = "",
  sub = "",
  xlab = NULL,
  ylab = NULL,
  ...
)

## S4 method for signature 'count,ANY'
draw(
  x,
  y,
  col = 2,
  facet = list(),
  main = "",
  sub = "",
  xlab = NULL,
  ylab = NULL,
  ...
)

## S4 method for signature 'table,ANY'
draw(
  x,
  y,
  col = 1:nrow(x),
  log = "",
  ...,
  ylim = NULL,
  yat = NULL,
  beside = TRUE
)

## S4 method for signature 'humdrumR.table,ANY'
draw(
  x,
  y,
  col = 2,
  facet = list(),
  main = "",
  sub = "",
  xlab = NULL,
  ylab = NULL,
  ...
)

## S4 method for signature 'probability,ANY'
draw(x, y, col = 1:nrow(x), log = "", ..., yat = NULL, beside = TRUE)

## S4 method for signature 'discrete,numeric'
draw(x, y, col = 3, log = "", breaks = "Sturges", ..., yat = NULL)

## S4 method for signature 'list,numeric'
draw(x, y, col = 3, log = "", breaks = "Sturges", ..., yat = NULL)

## S4 method for signature 'formula,ANY'
draw(x, y, col = 2, xlab = NULL, ylab = NULL, data = NULL, ...)

## S4 method for signature 'humdrumR,ANY'
draw(
  x,
  y,
  col = 2,
  facet = list(),
  main = "",
  sub = "",
  xlab = NULL,
  ylab = NULL,
  ...
)

Details

draw() is a generic function, which does different plots depending on the data you pass to its x and y arguments.

  • x and y both numeric: scatter plot.

  • x numeric by itself: histogram.

  • y numeric by itself: quantile plot.

  • x is a table: barplot.

  • y is numeric, x is character or factor: a violin plot.

All the standard arguments to base-R plots can be used to customize plots. See par() for a full list.


Computational-Cognitive-Musicology-Lab/humdrumR documentation built on Oct. 22, 2024, 9:28 a.m.