# How to fill a plot region with tilted lines without using HatchFilling?

I want to fill the region below the horizontal line at 50.9 with tilted lines. For recent versions of Mathematica, this can be done using HatchFilling[]. I am using v11 that does not support it.

Question

What can be done to fill the indicated region using tilted lines but without using HatchFilling[]?

Here is my code for the plot:

Subscript[θ,23][δ_, θ12_, θ13_, α_, β_] := -(180/(2 π)) ArcTan[(Cos[(2 (α + β + δ) ) Degree] Sin[2 θ12 Degree] Cos[θ13 Degree] )/(Cos[(2 (α + β) + δ) Degree] Cos[θ12 Degree]^2 Sin[2 θ13 Degree])];
Tab1 = Table[{δ,Subscript[θ, 23][δ, Random[Real, {31.61 , 36.27 }],
Random[Real, {8.22 , 8.99 }], Random[Real, {-6 , 6 }],Random[Real, {-45, -20 }]]}, {δ , 0 , 360, 1 Degree}];
Tab2 =DeleteCases[Tab1, {_?(0 < # < 20 || 31 < # < 45 || 55 < # < 128 || 135 < # < 148 || 152 < # < 225 || 231 < # < 300 || 315 < # < 331 || 342 < # < 360 &), _}];
P1 = ListPlot[ Tab2, Frame -> { True, True, True, True}, PlotRange -> {40, 55}, FrameLabel -> {δ, Subscript[θ, 23]}, FrameStyle -> Thick, PlotMarkers -> {Automatic, 5},
BaseStyle -> {FontSize -> 14}, GridLines -> {{}, {50.9}}, GridLinesStyle -> Darker[Gray, .8],Method -> {"GridLinesInFront" -> True}]


• Instead of using the deprecated Random[Real, ... construct, you can explore and use the RandomReal function. There are other related functions such as RandomInteger, RandomChoice, etc.
– Syed
Commented Sep 26, 2022 at 8:54

With HatchFilling[]

P0 = Plot[50.9, {x, 0, 400}, PlotStyle -> None, Filling -> Bottom,
FillingStyle -> Directive[Darker@Green, HatchFilling[]]
]

P1 = ListPlot[Tab2
, Frame -> {True, True, True, True}
, PlotRange -> {40, 55}
, FrameLabel -> {δ, Subscript[θ, 23]}
, FrameStyle -> Thick
, PlotMarkers -> {Automatic, 5}
, BaseStyle -> {FontSize -> 14}
, GridLines -> {{}, {50.9}}
, GridLinesStyle -> Darker[Gray, .8]
, Method -> {"GridLinesInFront" -> True}
]

Show[P1, P0]


Without HatchFilling[]

Draw lines at an angle of choice before the plot using Prolog.

g = ListPlot[Tab2
, Frame -> {True, True, True, True}
, PlotRange -> {40, 55}
, FrameLabel -> {\[Delta], Subscript[\[Theta], 23]}
, FrameStyle -> Thick
, PlotMarkers -> {Automatic, 5}
, BaseStyle -> {FontSize -> 14}
, GridLines -> {{}, {50.9}}
, GridLinesStyle -> Darker[Gray, .8]
, Method -> {"GridLinesInFront" -> True}
, Prolog -> {
Blue, Thin, Opacity[0.1]
, Table[Line[{{a, 0}, {300 + a, 50.9}}], {a, -300, 400, 5}]
}
]


• Why HatchFilling is not working in my case? I think because mine is mathematica 11. Is it so? Commented Sep 26, 2022 at 8:28
• Is there any other way to do the same thing without using Hatchfilling? Commented Sep 26, 2022 at 8:29
• @SangeetaDey I have updated the answer. HatchFilling[] was introduced on {2020, 3, 18} whereas Mathematica 11 was introduced around August 2016.
– Syed
Commented Sep 26, 2022 at 8:41
• Thank you so much. I am really grateful. Commented Sep 26, 2022 at 8:56
• You are most welcome. Thanks for the accept.
– Syed
Commented Sep 26, 2022 at 8:57