HatchFilling exports as non-vector graphics
You can use RegionPlot
and the options MeshFunctions
+ Mesh
+ MeshStyle
RegionPlot[Rectangle[], Mesh -> 50,
MeshFunctions -> {#1 + #2 &, #1 - #2 &},
MeshStyle -> {Directive[Thin, Blue], Directive[Thin, Red]},
PlotStyle -> None, BoundaryStyle -> None, Frame -> False]
Add the option MeshShading -> {{White, Cyan}, {Orange, White}}
to get
RegionPlot[Rectangle[], Mesh -> 15,
MeshFunctions -> {#1 + 2 #2 &, # - 2 #2 &},
MeshStyle -> {Directive[Thick, White], Directive[Thick, White]},
PlotStyle -> None,
MeshShading -> Dynamic[{{RandomColor[], RandomColor[]}, {RandomColor[],
RandomColor[]}}],
BoundaryStyle -> None, Frame -> False, ImageSize -> Large]
RegionPlot[Annulus[], Mesh -> {50, 20},
MeshFunctions -> {Sin[# + #2] &, Norm[{# , # - #2}] &},
MeshStyle -> {Directive[Thick, White], Directive[Thick, White]},
PlotStyle -> None,
MeshShading -> Dynamic[{{RandomColor[], White}, {White, RandomColor[]}}],
BoundaryStyle -> None, Frame -> False, ImageSize -> Large]
RegionPlot[Disk[], Mesh -> 20,
MeshFunctions -> {# + #2 RandomReal[{1, 1.2}] &,
# + #2 RandomReal[{-1.2, -1.}] &},
MeshStyle -> {Directive[Thick, White], Directive[Thick, White]},
PlotStyle -> None,
MeshShading -> Dynamic[{{RandomColor[], White}, {White,
RandomColor[]}}], BoundaryStyle -> None, Frame -> False,
ImageSize -> Large]
Block[{z = u + I v, pa = PadeApproximant[Exp[z], {z, 0, {5, 0}}]},
RegionPlot[Abs[pa/Exp[z]] > 1, {u, -4, 4}, {v, -4, 4},
ImageSize -> Large, PlotPoints -> 100, Mesh -> 70,
MeshFunctions -> {#1 + #2 &, #1 - #2 &},
MeshShading -> {{White, Cyan}, {Orange, White}},
MeshStyle -> {Directive[AbsoluteThickness[1], Blue],
Directive[AbsoluteThickness[1], Red]}, PlotStyle -> None,
BoundaryStyle -> None, Frame -> False]]
See also: This answer to a related Q/A
I have written a quick and dirty function to fill rectangular shapes with lines. It is not generalizable, it only works with rectangular shapes and for angles less than 90 degrees, but maybe it can be useful for someone.
RectangleLineFill[min_, max_, step_, angle_] := {
Table[Line[{
{i, min[[2]]},
{Min[(max[[2]] - min[[2]])/Tan[angle] + i, max[[1]]],
min[[2]] + (Min[(max[[2]] - min[[2]])/Tan[angle] + i,
max[[1]]] - i)*Tan[angle]}
}], {i, min[[1]], max[[1]], step}],
Table[Line[{
{min[[1]], i},
{Min[(max[[2]] - i)/Tan[angle] + min[[1]], max[[1]]],
i + (Min[(max[[2]] - i)/Tan[angle] + min[[1]], max[[1]]] -
min[[1]])*Tan[angle]}
}], {i, min[[2]] + step, max[[2]], step}]
} /. {Line[{x_, y_}] -> If[x == y, Null, Line[{x, y}]]}
Usage example:
Graphics[{Red, RectangleLineFill[{0, 0}, {3, 2}, 1/10, 45 \[Degree]]}]