# How to force the RegionPlot to shade a narrow region?

I have an interactive demonstration, which (very simplified to leave out unnecessary details) looks as follows:

    Manipulate[
Show[{
Plot[{x, a*x}, {x, -1, 1}, PlotRange -> {-1, 1}],
RegionPlot[x < y < a*x, {x, -1, 1}, {y, -1, 1}]
}], {a, 0.5, 1.5}]


On the screen I see this: .

I draw the arrow to point out a defect in the shading: the shading does not cover a narrow triangle in the vicinity of the coordinates origin, though it should.

More than that. The degree of shading varies as I move the slider.

I could, of course, use the option "Filling" in the Plot statement and remove the RegionPlot at all. I need, however, the filling to show the region where one of the lines is above the other. It seemed that the RegionPlot is in this case a more natural choice.

Can you imagine a workaround with the RegionPlot, or I should inevitably go to Filling in the Plot statement?

-
fyi: \$PerformanceGoal switches to "Speed" when you move the slider, that is why the degree of shading varies. – Kuba Nov 8 '13 at 10:39
PlotPoints->100 works OK for example. – Pickett Nov 8 '13 at 13:45

## 1 Answer

You can play with PlotPoints, MaxRecurrsion etc. but this will slow you down. I think RegionPlot just doesn't fit here well.

I would use Filling, notice that I've change the order of functions in Plot so the White filling is on top.

Manipulate[
Plot[{a*x, x}, {x, -1, 1}, PlotRange -> {-1, 1}, PlotStyle -> {Red, Blue},
Filling -> {2 -> {Bottom, White}, 1 -> {Bottom, Orange}},
BaseStyle -> Thick]
, {a, 0.5, 1.5}]


-
Thank you, and it is a pity. In a trough case I have with all its conditions the RegionPlot fits more natural. – Alexei Boulbitch Nov 11 '13 at 7:52