plot_fn: A function to plot a plot.

View source: R/plot_fun.R

plot_fnR Documentation

A function to plot a plot.

Description

plot_fn is a function that uses parameters for plotting a plot.

Usage

plot_fn(
  x = NA,
  y = 1,
  A = TRUE,
  B = FALSE,
  C = TRUE,
  D = FALSE,
  E = FALSE,
  F = FALSE,
  f = c(rev(pal_seeblau), "white", pal_pinky),
  g = "white"
)

Arguments

x

Numeric (integer > 0). Default: x = NA.

y

Numeric (double). Default: y = 1.

A

Boolean. Default: A = TRUE.

B

Boolean. Default: B = FALSE.

C

Boolean. Default: C = TRUE.

D

Boolean. Default: D = FALSE.

E

Boolean. Default: E = FALSE.

F

Boolean. Default: F = FALSE.

f

A color palette (as a vector). Default: f = c(rev(pal_seeblau), "white", pal_pinky). Note: Using colors of the unikn package by default.

g

A color (e.g., a color name, as a character). Default: g = "white".

Details

plot_fn is deliberately kept cryptic and obscure to illustrate how function parameters can be explored.

plot_fn also shows that brevity in argument names should not come at the expense of clarity. In fact, transparent argument names are absolutely essential for understanding and using a function.

plot_fn currently requires pal_seeblau and pal_pinky (from the unikn package) for its default colors.

See Also

plot_fun for a related function; pal_ds4psy for a color palette.

Other plot functions: plot_charmap(), plot_chars(), plot_fun(), plot_n(), plot_text(), plot_tiles(), theme_clean(), theme_ds4psy(), theme_empty()

Examples

# Basics: 
plot_fn()

# Exploring options: 
plot_fn(x = 2, A = TRUE)
plot_fn(x = 3, A = FALSE, E = TRUE)
plot_fn(x = 4, A = TRUE,  B = TRUE, D = TRUE)
plot_fn(x = 5, A = FALSE, B = TRUE, E = TRUE, f = c("black", "white", "gold"))
plot_fn(x = 7, A = TRUE,  B = TRUE, F = TRUE, f = c("steelblue", "white", "forestgreen"))


ds4psy documentation built on Sept. 15, 2023, 9:08 a.m.