# How to shade a region using Filling function

I have two following functions:

g21n = √(253349/60000 - g1^2 + 14801/(9375000 2^(2/3) (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (605441173 2^(1/3))/(9375 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (75490236 2^(1/3)g1^2)/(625 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (1/(768 2^(1/3)))((170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)))
g22n = √(253349/60000 - g1^2 - 2088267/(6250000 2^(2/3) (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) - (302719024 2^(1/3))/(9375 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (299124874 I 2^(1/3))/(3125 Sqrt[3] (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (2088267 I Sqrt[3])/(6250000 2^(2/3) (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (47922 I 2^(1/3)Sqrt[3])/(125 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) - (37745118 2^(1/3)g1^2)/(625 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) + (37745118 I 2^(1/3) Sqrt[3]g1^2)/(625 (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + √(4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2))^(1/3)) - (1/(1536 2^(1/3)))((170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + Sqrt[4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2])^(1/3)) - (1/(512 2^(1/3) Sqrt[3]))I (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625 + Sqrt[4 (-(19374117772816/390625) - (57976501248 g1^2)/625)^3 + (170554388570595993728/244140625 - (255189599799201792 g1^2)/78125 - (190911920799744 g1^4)/625)^2])^(1/3))


Plotting both g21n and g22n as a function of g1 with the Filling command:

Plot[{g21n, g22n}, {g1, 0, 10}, FrameLabel -> {"\!$$\*SubscriptBox[\(g$$, $$1$$]\)", "\!$$\*SubscriptBox[\(g$$, $$2$$]\)"}, PlotRange -> {{0, 3}, {0, 6}}, PlotStyle -> {Directive[Blue], Directive[Orange]}, ImageSize -> Medium, LabelStyle -> {20, Black, Bold}, AspectRatio -> 1, WorkingPrecision -> 20, Frame -> True, FrameStyle -> Directive[Black], FrameLabel -> {Style["\!$$\*SubscriptBox[\(g$$, $$2$$]\)", Italic, Bold, Black, 12], Style["\!$$\*SubscriptBox[\(g$$, $$1$$]\)", Italic, Bold, Black, 12]}, FrameTicksStyle -> Directive[Thick, Black, Bold], Filling -> {1 -> {Axis, Green}, 2 -> {Axis, White}} AspectRatio -> 1, PlotRangePadding -> None, PlotPoints -> 100, WorkingPrecision -> 20, Exclusions -> None]


Gives

I want the region bounded by the two curves to be shaded but it remains unshaded even with the Filling command. How should I go about filling the region between the two curves?

Edit: Fixed the brackets for g21n

• some parentheses are missing in the definition of g21n.
– kglr
Oct 31, 2018 at 20:54
• Try Filling -> {1 -> {2}} Oct 31, 2018 at 21:41
• @kglr Fixed the parentheses. Sorry about that. Oct 31, 2018 at 21:59
• @CarlWoll There are some leftover, unfilled white spaces when I do Filling -> {1 -> {2}} Oct 31, 2018 at 22:01

Use {g21n, Max[0, Re@g22n]} as the first argument of Plot with the option Filling -> {1 -> {{2}, Green}}:
I had an epiphany, keep the argument of Plot as {g21n, g22n} and just do Filling -> {{1 -> {Axis, Gray}}, {2 -> {Axis, White}}}
• I will just do {2 -> {Axis, "Background color"}} assuming I know the color that I'm overlaying on. Either way, @kglr works just as well, but I need a cusp to be evident between the blue and orange curve. But still, thanks! Oct 31, 2018 at 22:54