contour_plot: Contour plots of functions of two variables

View source: R/contour_plot.R

contour_plotR Documentation

Contour plots of functions of two variables

Description

Creates a ggplot2-compatible contour plot of a function of two variables.

Usage

contour_plot(
  ...,
  npts = 100,
  labels = TRUE,
  filled = TRUE,
  contours_at = NULL,
  n_contours = 10,
  n_fill = 50,
  alpha = 1,
  fill_alpha = 0.1,
  label_alpha = 1,
  label_placement = 0.5,
  contour_color = "blue",
  label_color = contour_color,
  skip = 1,
  guide = FALSE,
  guide_title = "output",
  color_scale = scale_color_viridis_c(),
  fill_scale = scale_fill_viridis_d()
)

Arguments

...

Canonical first "three" arguments: [Previous layer], tilde expression, domain

npts

Integer number of points on each axis at which to evaluate the function

labels

Logical flag: label the contours

filled

Logical flag: fill between the contours

contours_at

Vector of numbers. Contours will be drawn at these levels of the output.

n_contours

hint at number of contours to show

n_fill

Integer number of points for calculating fill

alpha

Transparency of contours in [0-1]

fill_alpha

Transparency of fill

label_alpha

Likewise, for contour labels

label_placement

A number, between 0 and 1, suggesting where to place the contour labels. Default: 0.5. This can be useful when there are two contour layers in one plaot.

contour_color

Set to a string, e.g. "blue" for contours to be drawn in a fixed color

label_color

Defaults to contour_color. Can be set to a

skip

Small integer. Skip this many contours between labeled contours

guide

Logical flag, whether to show a color guide.

guide_title

Character string for title of guide (if any)

color_scale

See ggplot2 color scales.

fill_scale

See ggplot2 fill scales

Examples

## Not run: 
contour_plot(sin(0.2*x*y) ~ x & y, domain(x=-10.3:4.5, y=2:7.5))
contour_plot(x + y ~ x & y)
contour_plot(sin(0.2*x*y)) # but better to use tilde expression

## End(Not run)


mosaicCalc documentation built on Sept. 15, 2022, 9:06 a.m.