RegionPlot
RegionPlot[pred,{x,xmin,xmax},{y,ymin,ymax}]
makes a plot showing the region in which pred is True.
RegionPlot[{pred1,pred2,…},…]
plots several regions corresponding to the predi.
RegionPlot[{…,w[predi,…],…},…]
plots predi with features defined by the symbolic wrapper w.
Details and Options
- The predicate pred can be any logical combination of inequalities.
- The region plotted by RegionPlot can contain disconnected parts.
- RegionPlot treats the variable x and y as local, effectively using Block.
- RegionPlot has attribute HoldAll and evaluates pred only after assigning specific numerical values to x and y. In some cases, it may be more efficient to use Evaluate to evaluate pred symbolically first.
- The following wrappers w can be used for the predi:
-
Annotation[predi,label] provide an annotation for the predi Button[predi,action] evaluate action when the curve for predi is clicked Callout[predi,label] label the region with a callout Callout[predi,label,pos] place the callout at relative position pos EventHandler[predi,events] define a general event handler for predi Hyperlink[predi,uri] make the region a hyperlink Labeled[predi,label] label the region Labeled[predi,label,pos] place the label at relative position pos Legended[predi,label] identify the region in a legend PopupWindow[predi,cont] attach a popup window to the region StatusArea[predi,label] display in the status area on mouseover Style[predi,styles] show the region using the specified styles Tooltip[predi,label] attach a tooltip to the region Tooltip[predi] use regions as tooltips - Wrappers w can be applied at multiple levels:
-
w[predi] wrap the predi w[{predi,…}] wrap a collection of predi w1[w2[…]] use nested wrappers - Callout, Labeled and Placed can use the following positions pos:
-
Automatic automatically placed labels Above, Below, Before, After positions around the region {x,y} position near {x,y} {pos,epos} epos in label placed at relative position pos of the region - RegionPlot has the same options as Graphics, with the following additions and changes: [List of all options]
-
AspectRatio 1 ratio of height to width BoundaryStyle Automatic the style for the boundary of each region ColorFunction Automatic how to color the interior of each region ColorFunctionScaling True whether to scale the argument to ColorFunction EvaluationMonitor None expression to evaluate at every function evaluation Frame True whether to draw a frame around the plot LabelingSize Automatic maximum size of callouts and labels MaxRecursion Automatic the maximum number of recursive subdivisions allowed Mesh None how many mesh lines to draw MeshFunctions {#1&,#2&} what mesh lines to draw MeshShading None how to shade regions between mesh lines MeshStyle Automatic the style for mesh lines Method Automatic the method to use for refining regions PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotLabels None labels to use for curves PlotLegends None legends for regions PlotPoints Automatic initial number of sample points PlotRange Full the range of values to include in the plot PlotRangeClipping True whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotStyle Automatic graphics directives to specify the style for regions PlotTheme $PlotTheme overall theme for the plot ScalingFunctions None how to scale individual coordinates TextureCoordinateFunction Automatic how to determine texture coordinates TextureCoordinateScaling True whether to scale arguments to TextureCoordinateFunction WorkingPrecision MachinePrecision the precision used in internal computations - Typical settings for PlotLegends include:
-
None no legend Automatic automatically determine the legend "Expressions" use f1, f2, … as the legend labels {lbl1,lbl2,…} use lbl1, lbl2, … as the legend labels Placed[lspec,…] specify placement for the legend - RegionPlot initially evaluates pred at a grid of equally spaced sample points specified by PlotPoints. Then it uses an adaptive algorithm to subdivide at most MaxRecursion times, attempting to find the boundaries of all regions in which pred is True.
- You should realize that since it uses only a finite number of sample points, it is possible for RegionPlot to miss regions in which pred is True. To check your results, you should try increasing the settings for PlotPoints and MaxRecursion.
- With the default setting PlotRange->Full, RegionPlot will explicitly include the full ranges xmin to xmax and ymin to ymax for x and y.
- With Mesh->All, RegionPlot will explicitly draw mesh lines to indicate the subdivisions it used to find each region.
- RegionPlot can in general only find regions of positive measure; it cannot find regions that are just lines or points.
- The arguments supplied to functions in MeshFunctions are x, y. ColorFunction and TextureCoordinateFunction are by default supplied with scaled versions of these arguments.
- ScalingFunctions{sx,sy} scales the x axis with sx and the y axis with sy.
- Common built-in scaling functions s include:
-
"Log" log scale with automatic tick labeling "Log10" base-10 log scale with powers of 10 for ticks "SignedLog" log-like scale that includes 0 and negative numbers "Reverse" reverse the coordinate direction "Infinite" infinite scale - RegionPlot returns Graphics[GraphicsComplex[data]].
-
AlignmentPoint Center the default point in the graphic to align with AspectRatio 1 ratio of height to width Axes False whether to draw axes AxesLabel None axes labels AxesOrigin Automatic where axes should cross AxesStyle {} style specifications for the axes Background None background color for the plot BaselinePosition Automatic how to align with a surrounding text baseline BaseStyle {} base style specifications for the graphic BoundaryStyle Automatic the style for the boundary of each region ColorFunction Automatic how to color the interior of each region ColorFunctionScaling True whether to scale the argument to ColorFunction ContentSelectable Automatic whether to allow contents to be selected CoordinatesToolOptions Automatic detailed behavior of the coordinates tool Epilog {} primitives rendered after the main plot EvaluationMonitor None expression to evaluate at every function evaluation FormatType TraditionalForm the default format type for text Frame True whether to draw a frame around the plot FrameLabel None frame labels FrameStyle {} style specifications for the frame FrameTicks Automatic frame ticks FrameTicksStyle {} style specifications for frame ticks GridLines None grid lines to draw GridLinesStyle {} style specifications for grid lines ImageMargins 0. the margins to leave around the graphic ImagePadding All what extra padding to allow for labels etc. ImageSize Automatic the absolute size at which to render the graphic LabelingSize Automatic maximum size of callouts and labels LabelStyle {} style specifications for labels MaxRecursion Automatic the maximum number of recursive subdivisions allowed Mesh None how many mesh lines to draw MeshFunctions {#1&,#2&} what mesh lines to draw MeshShading None how to shade regions between mesh lines MeshStyle Automatic the style for mesh lines Method Automatic the method to use for refining regions PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotLabel None an overall label for the plot PlotLabels None labels to use for curves PlotLegends None legends for regions PlotPoints Automatic initial number of sample points PlotRange Full the range of values to include in the plot PlotRangeClipping True whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotRegion Automatic the final display region to be filled PlotStyle Automatic graphics directives to specify the style for regions PlotTheme $PlotTheme overall theme for the plot PreserveImageOptions Automatic whether to preserve image options when displaying new versions of the same graphic Prolog {} primitives rendered before the main plot RotateLabel True whether to rotate y labels on the frame ScalingFunctions None how to scale individual coordinates TextureCoordinateFunction Automatic how to determine texture coordinates TextureCoordinateScaling True whether to scale arguments to TextureCoordinateFunction Ticks Automatic axes ticks TicksStyle {} style specifications for axes ticks WorkingPrecision MachinePrecision the precision used in internal computations
List of all options
Examples
open allclose allBasic Examples (5)
Scope (19)
Sampling (5)
More points are sampled where the function changes quickly:
Areas where the function is not True are excluded:
Use PlotPoints and MaxRecursion to control adaptive sampling:
Labeling and Legending (4)
Label regions with Labeled:
Place the labels relative to the regions:
Label regions with Callout:
Callout leader is turned off when label is inside the region:
Add legends with PlotLegends:
Add legends with Legended:
Presentation (10)
Provide an explicit PlotStyle for the region:
Provide an explicit BoundaryStyle for the region boundary:
Use legends for multiple regions:
Use automatic legends for gradient colored regions:
Style the areas between mesh lines:
Options (56)
BoundaryStyle (4)
Use None to show regions without any boundary:
ColorFunction (5)
Color regions by scaled and values:
Named color functions use the scaled direction:
Color regions according to a function of and :
ColorFunction has higher priority than PlotStyle:
ColorFunction has lower priority than MeshShading:
LabelingSize (2)
Mesh (7)
MeshShading (4)
Use None to remove regions:
Lay a checkerboard pattern over a region:
MeshShading has a higher priority than PlotStyle:
MeshShading has a higher priority than ColorFunction:
MeshStyle (2)
PerformanceGoal (2)
PlotLegends (8)
Use legends for multiple regions:
Use automatic legends for a gradient colored region:
PlotLegends automatically picks up styles:
Use functions as legend texts:
Use Placed to change legend position:
Use SwatchLegend to change legend appearance:
PlotStyle (5)
Regions are shown in light blue:
Use None to just show the boundary of the region:
PlotTheme (2)
ScalingFunctions (5)
By default, plots have linear scales in each direction:
Scale the x axis to go from positive to negative instead:
Use a sign-aware log scale for the y axis:
Domain that contains Infinity is scaled automatically:
TextureCoordinateFunction (2)
Applications (8)
Find the intersection of two half-spaces:
Simple regions including a disk:
Visualize regions in the complex plane:
Identify where a function is real-valued:
Integrate over a region that contains parameters:
Visualize the regions for the three different cases:
Absolute stability regions for Euler forward:
Stability regions for Euler backward and Tustin or midpoint rules:
Stability regions for explicit Runge–Kutta rules of order 2, 3, 4, and 5:
Relative stability or order-stars regions for {0,n} Padé approximants:
Properties & Relations (9)
RegionPlot samples more points where it needs to:
Use RegionPlot3D for volumes:
Use ContourPlot and ContourPlot3D for systems of equalities:
Use ComplexRegionPlot for regions in the complex plane:
Use RegionFunction to constrain other plots:
Use ParametricPlot for plane parametric curves and regions:
Use Integrate or NIntegrate to integrate over regions:
Use Maximize, NMaximize, or FindMaximum to optimize over regions:
Use Reduce to get a cylindrical representation of the region:
Use FindInstance to find specific samples in regions:
Possible Issues (2)
RegionPlot will only visualize two-dimensional regions:
Use ContourPlot to visualize one-dimensional regions:
Piecewise constant functions can have two-dimensional level sets:
Text
Wolfram Research (2007), RegionPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionPlot.html (updated 2022).
CMS
Wolfram Language. 2007. "RegionPlot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/RegionPlot.html.
APA
Wolfram Language. (2007). RegionPlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegionPlot.html