Re: Graphing sets of linear inequalities
- To: mathgroup at smc.vnet.net
- Subject: [mg53969] Re: [mg53910] Graphing sets of linear inequalities
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 5 Feb 2005 03:16:35 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Here are two methods for making your plot.
<< Graphics`FilledPlot`
<< Graphics`Colors`
<< Graphics`InequalityGraphics`
The first method used FilledPlot. We need to change your inequalities into
one for y values.
-2 < x + 2y < 4;
(# - x)/2 & /@ %
(1/2)*(-2 - x) < y < (4 - x)/2
FilledPlot[{(1/2)*(-2 - x), (4 - x)/2}, {x, -2, 4},
Fills -> LightCoral,
AspectRatio -> Automatic,
Frame -> True,
FrameLabel -> {x, y},
Axes -> None,
PlotLabel -> -2 < x + 2*y < 4,
Background -> Linen,
ImageSize -> {450, Automatic}];
The second method is to use InequalityPlot.
InequalityPlot[
-2 < x + 2y < 4, {x, -2, 4}, {y, -3, 3},
Fills -> LightCoral,
Frame -> True,
FrameLabel -> {x, y},
Axes -> None,
PlotLabel -> -2 < x + 2y < 4,
Background -> Linen,
ImageSize -> {450, Automatic}];
Note that a liberal use of plot options are often necessary to make a nice
looking plot.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: DJ Craig [mailto:spit at djtricities.com]
To: mathgroup at smc.vnet.net
How do you graph something like this:
-2 = x + 2y = 4
I need the areas where this is true to be shaded, and solid lines at x
+ 2y = -2 and x + 2y = 4.