# How can one generate plots having regions filled with vector hatching?

I'm using Mathematica 13.3, I want to have a vector output image from all of my plots using hatch filling.

For a test code:

RegionPlot[Sin[x] Sin[y] > 1/4, {x, -10, 10}, {y, -10, 10},
PlotStyle -> {RGBColor["#0077BB"], HatchFilling[]},
BoundaryStyle -> Thickness[0.01]]


But the output ALWAYS contains bitmap fractures...clearly visible after zooming. How it can be solved with hatch filling.

• I can see the very small "fractures" also in the documentation of HatchFilling.
– eldo
Commented Oct 20, 2023 at 16:10

• Export such drawing to pdf is not a vector format pdf file. We use Mesh to draw such hatchfilling instead.
plot = RegionPlot[Sin[x] Sin[y] > 1/4, {x, -10, 10}, {y, -10, 10},
BoundaryStyle -> Thickness[0.01], PlotStyle -> None, Mesh -> 80,
MeshFunctions -> {#2 - #1 &},
MeshStyle -> {RGBColor["#0077BB"], AbsoluteThickness[1.5]}]
Export["test.pdf", plot] // SystemOpen


• For 20 Degree slope, since the equation of such lines are y=Tan[20 Degree] x +b ( where b is variety), so we can set  MeshFunctions -> {#2 - Tan[20 Degree] #1 &} to change the angle of lines.
Clear[plot];
plot =
RegionPlot[Sin[x] Sin[y] > 1/4, {x, -10, 10}, {y, -10, 10},
BoundaryStyle -> Thickness[0.01], PlotStyle -> None, Mesh -> 200,
MeshFunctions -> {#2 - Tan[20 Degree] #1 &},
MeshStyle -> {RGBColor["#0077BB"], AbsoluteThickness[1]}];
Export["test.pdf", plot] // SystemOpen


• Nice replacement of Hatching. One question related to usage of {#2 - #1 &}...The filling inside a region requires two things: Spacing between lines & angle of those lines. If you can suggest something in MeshFunction that can fulfil this. Commented Oct 22, 2023 at 1:05
• Thanks^Infinity... Commented Oct 22, 2023 at 2:20