Skip to contents

Supports identifiers (including Greek letters), arithmetic and comparison operators, subscripts, powers, fractions, roots, sums, integrals, limits, accents, and common probability notation such as Pr(X <= x). A formula is validated and passed unevaluated to plotmath. For example, "lim(f(x), x %->% 0)" places a limit beneath the operator. Matrices, cases and aligned systems are outside this grammar. Use markup_grob(format = "mixed") for prose around an equation.

Usage

formula_grob(
  label,
  x = 0.5,
  y = 0.5,
  hjust = 0.5,
  vjust = 0.5,
  angle = 0,
  gp = grid::gpar()
)

Arguments

label

One character string. For formulas use one plotmath string or a length-one expression.

x, y

Position in grid units, or a number in normalized parent units.

hjust, vjust

Numeric horizontal and vertical anchor. Zero and one select opposite edges. Values outside this interval provide extra offset.

angle

Counterclockwise rotation in degrees.

gp

Graphical parameters passed to grid.

Value

A grid text grob containing a plotmath expression.

Examples

formula_grob("frac(x[i] - mu, sigma)")
#> text[GRID.text.618]