I want to fill in the region between the curves.
So far I have this:
Plot[{x + 7, 9 - x^2}, {x, 0, 1.5}, Filling -> {1 -> {2}}]
But I want something like this:
I want to fill in the region between the curves.
So far I have this:
Plot[{x + 7, 9 - x^2}, {x, 0, 1.5}, Filling -> {1 -> {2}}]
But I want something like this:
Alternatively, you can use the +/- option of Filling
Plot[{x + 7, 9 - x^2}, {x, 0, 1.5}, Filling -> {1 -> {{2}, {LightBlue, White}}}]
ColorData[1][1]
. Then fiddle with the Opacity
until you're content.
$\endgroup$
– rcollyer
Sep 27 '13 at 19:38
Plot[...]//InputForm
:)
$\endgroup$
– ybeltukov
Sep 27 '13 at 19:47
Automatic
:)
$\endgroup$
– rm -rf♦
Sep 27 '13 at 19:50
It's like rm-rf says in his comments, it's not really clear what the logic is. There are already plenty of ways to use Filling
to produce the requested plot but here's a more general function to facilitate arbitrary logic:
shadeBoundedArea[plot_, region_] := Module[{rangex, rangey},
{rangex, rangey} = PlotRange /. AbsoluteOptions[plot];
Show[
plot,
RegionPlot[region, Evaluate@{x, Sequence @@ rangex},
Evaluate@{y, Sequence @@ rangey}]
]
]
Clear[x, y];
p = Plot[{f1[x], f2[x]}, {x, 0, 1.5}]
shadeBoundedArea[p, f1[x] < y < f2[x]]
Since Filling
shades between two curves in the plot, add an extra curve that serves as the limit.
Plot[{Max[x + 7, 9 - x^2], x + 7, 9 - x^2}, {x, 0, 1.5}, Filling -> {1 -> {2}}]
Plot[{x + 7, 9 - x^2}, {x, 0, 1.5},
Filling -> {1 -> {{2}, {{Opacity[0.2], Hue[0.67, 0.6, 0.6]}, None}}}]
Update: you can use Automatic
instead of {Opacity[0.2], Hue[0.67, 0.6, 0.6]}
.