inequality_constraint | R Documentation |
These functions are intended to annotate contour plots with constraint regions. Inequality constraints are shaded where the constraint is NOT satisfied. Equality constraints are shaded in a small region near where the constraint is satisfied.
inequality_constraint(
previous = NULL,
tilde,
domain,
npts = 100,
fill = "blue",
alpha = 1
)
equality_constraint(
previous = NULL,
tilde,
domain,
npts = 100,
fill = "blue",
alpha = 1
)
previous |
can be ignored by user. It supports the pipe syntax for layering graphics. |
tilde |
a tilde expression specifying the constraint. For an inequality constraint this should be a logical expression that is TRUE where the constraint is satisfied. For an equality constraint, the left-hand side of the tilde expression should be zero where the constraint IS satisfied. |
domain |
as in contour_plot(), the domain over which to graph the constraint |
npts |
a number specifying how finely to divide the domain in each direction. Default is 100, but this gives a discernably pixelated appearance to the shading. 200 or 300 is more appropriate for publication-quality graphics. |
fill |
the color to use for shading |
alpha |
the opacity of the shading |
ggplot2 graphics layers
inequality_constraint(x + y > 2 ~ y + x, domain(y=0:3, x=0:2))
equality_constraint(x + y - 2 ~ y + x, domain(y=0:3, x=0:2), npts=200, alpha=.3, fill="red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.