# How to put a bound with RegionPlot-Edited

I was trying this simple code to plot the contours within a specific region bounded by a limit

 Show[ContourPlot[X1, {a, 1*^-6, 0.02}, {b, 1*^-6, 0.02},
Contours -> {5, 5*10^2, 5*10^3}, ContourLabels -> True,
ContourShading -> {None, Lighter@Lighter@ColorData[97][1]},
ScalingFunctions -> {"Log10", "Log10"}],
RegionPlot[X1 > Br\[Tau]3\[Mu], {a, 1*^-6, 0.1}, {b, 1*^-6, 0.1}]]


with functions X1 and X2 are defined as

X1 = 1.3335698177171183*^8 a^2 - 3.636178913116437*^8 a b +
3.280532719877099*^8 b^2

X2 = 2.5163488578437388*^8 Abs[a]^2


and the limit is given by

Br\[Tau]3\[Mu] = 2.1*10^-8.


But it doesn't seem that the RegionPlot is acting as it should be, means, I don't get the clear idea about the region which is excluded by the limit. Is there any way to do it more efficiently ? Thanks.

Edits

Since RegionPlot and ScalingFunctions are not compatible with each other and as the value of X1 is still larger with previously used range of 'a' and 'b', I made some changes to get the contour within the plot.

Show[ContourPlot[X1, {a, 1*^-8, 2.8*^-8}, {b, 1*^-8, 1.8*^-8},
Contours -> {Br\[Tau]3\[Mu]},
ContourShading -> {None, Lighter@Lighter@ColorData[97][1]},
ContourLabels -> True, PlotPoints -> 100, PlotRange -> Full,
ScalingFunctions -> {"Log10", "Log10"}]]


Now my question is : Is there any way to generate that reference plot (in my previous post) where the excluded region is shown by the shaded region. Also contours of different orders (10^-7,10^-6 etc.) are shown in the same plot by different contour styles for the comparison purpose ?

## 1 Answer

Ah, I think I understand the problem a bit better now.

The 2 main issues I see:

1. I recommend using ContourPlot rather than RegionPlot in this case because RegionPlot does not support ScalingFunctions (although I'm not totally sure why it doesn't).
2. Your limit of $$Br\tau 3\mu = 2.1\times 10^{-8}$$ is smaller than anything plotted on the graph. (X1 /. {a -> 10^-6, b -> 10^-6}) > Br\[Tau]3\[Mu] yields True. Your graphs have the smallest a and smallest b as $$10^{-6}$$, and X1 becomes $$9.8\times 10^{-5}$$ there, which is still larger than your value. So either the entire plotted zone is being excluded, or else the entire plotted zone is included (I'm not sure whether you're trying to colour the included zone or excluded zone).

Let's pretend that your excluded zone is anything greater than 0.01:

X1 = 1.3335698177171183*^8 a^2 - 3.636178913116437*^8 a b +
3.280532719877099*^8 b^2

X2 = 2.5163488578437388*^8 Abs[a]^2

Br\[Tau]3\[Mu] = 0.01

Show[
ContourPlot[
X1,
{a, 1*^-6, 0.1},
{b, 1*^-6, 0.1},
Contours -> {0.01},
ContourShading -> {Blue, Green},
PlotPoints -> 100,
PlotRange -> Full,
ScalingFunctions -> {"Log10", "Log10"}
],
ContourPlot[
X1,
{a, 1*^-6, 0.1},
{b, 1*^-6, 0.1},
Contours -> {5, 5*10^2, 5*10^3},
ContourLabels -> True,
ContourShading -> {None, Lighter@Lighter@ColorData[97][1]},
PlotPoints -> 100,
PlotRange -> Full,
ScalingFunctions -> {"Log10", "Log10"}
]
]


The main things to note:

1. I've plotted the exclusion zone first so that it's underneath. If this isn't what you want, plot it second so that it's on top.
2. In this scenario, anything that is blue is included, and anything that is green or has green underneath it is excluded. Because I'm exluding anything greater than 0.01, almost the entire plot is in the exclusion zone. If I decrease the exclusion level more, even more would be green.
3. I adjusted both plots to plot the same a and b ranges because I felt it looked weird to have them cover different ranges, but you can easily change this back.

We can see the same plot if we have the exclusion zone charted second:

This ends up covering everything that got plotted before. I assume this is undesirable, but I'm not sure.

EDIT 01:

Is this what you're looking for?

Show[
ContourPlot[
X1,
{a, 1*^-8, 2.8*^-8},
{b, 1*^-8, 1.8*^-8},
Contours -> {Br\[Tau]3\[Mu]},
ContourShading -> {None, Lighter@Lighter@ColorData[97][1]},
PlotPoints -> 100,
PlotRange -> Full,
PlotRangePadding -> None,
ScalingFunctions -> {"Log10", "Log10"}
],
ContourPlot[
X1,
{a, 1*^-8, 2.8*^-8},
{b, 1*^-8, 1.8*^-8},
Contours -> {1.*^-8, 1.5*^-8, 2.*^-8, 2.5*^-8},
ContourLabels -> All,
ContourShading -> None,
ContourStyle ->
Thread[Directive[
AbsoluteThickness[1.5], {Black, Dashed,
Dashing[{0.02, 0.02, 0.008, 0.02}], Dashing[{0.03, 0.03}]}]],
PlotPoints -> 100,
PlotRange -> Full,
ScalingFunctions -> {"Log10", "Log10"}]]


EDIT 02:

Adding in the extra contours:

X1 = 1.3335698177171183*^8 a^2 - 3.636178913116437*^8 a b +
3.280532719877099*^8 b^2

X2 = 2.5163488578437388*^8 Abs[a]^2

Br\[Tau]3\[Mu] = 2.1*10^-8.

arange = {a, 1*^-8, 1*^-6};
brange = {b, 1*^-8, 5*^-7};
Show[ContourPlot[X1, arange, brange, Contours -> {Br\[Tau]3\[Mu]},
ContourShading -> {None, Lighter@Lighter@ColorData[97][1]},
PlotPoints -> 100, PlotRange -> Full, PlotRangePadding -> None,
ScalingFunctions -> {"Log10", "Log10"}],
ContourPlot[X1, arange, brange,
Contours -> {1.*^-8, 1.5*^-8, 2.*^-8, 2.5*^-8, 10.^-7, 10.^-6,
10.^-5}, ContourLabels -> All, ContourShading -> None,
ContourStyle ->
Thread[Directive[
AbsoluteThickness[1.5], {Black, Dashed,
Dashing[{0.02, 0.02, 0.008, 0.02}], Dashing[{0.03, 0.03}], Blue,
Pink, Green, Red}]], PlotPoints -> 100, PlotRange -> Full,
ScalingFunctions -> {"Log10", "Log10"}]]


• Thanks again for your reply. I've edited the post to mention my further concerns. Hope that is clear, otherwise please let me know.
– Joy
Commented Apr 14, 2020 at 8:17
• @Joy I've added another attempt. Is this close to what you were looking for? Commented Apr 15, 2020 at 20:53
• not exactly. What I was trying to get are following:
– Joy
Commented Apr 16, 2020 at 14:34
• Can I add contours 1.*^-5, 1*^-4, 1.*^-3, 1*^-2 etc. on this plot ?
– Joy
Commented Apr 16, 2020 at 14:47
• @Joy Not as it is. The plot does not contain those values so adding those contours would do nothing. Those contour lines are far off the top right edge of the graph. If you want those contours, expand the range of a and b. However, any contour over 2.1x10^-8 is in your forbidden region anyways, so I’m not totally sure why you want to plot those. Commented Apr 16, 2020 at 17:32