This problem is one of those things that comes up a lot, but each question has slight differences that make agreement about being a duplicate is hard to reach. Here is a solution that can achieved by a slight tweak to one line in
@Szabolcs' answer:
cleanRegionPlot@RegionPlot[..]
For instance:
Export[FileNameJoin[{$TemporaryDirectory, "clean.pdf"}],
cleanRegionPlot@RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}]];
First@Import[%]
From @Szabolcs' code:
cleanRegionPlot[cp_Graphics] :=
Module[{points, groups, regions, lines},
groups =
Cases[cp, {style__, g_GraphicsGroup} :> {{style}, g}, Infinity];
points =
First@Cases[cp, GraphicsComplex[pts_, ___] :> pts, Infinity];
regions = Table[
Module[{group, style, polys, edges, cover, graph},
{style, group} = g;
polys =
Join @@ Cases[group, Polygon[pt_, ___] :> pt, Infinity];
edges = Join @@ (Partition[#, 2, 1, 1] & /@ polys);
cover = Cases[Tally[Sort /@ edges], {e_, 1} :> e];
graph = Graph[UndirectedEdge @@@ cover];
{Sequence @@ style,
FilledCurve[
List /@ Line /@ First /@
Map[First,
FindEulerianCycle /@ (Subgraph[graph, #] &) /@
ConnectedComponents[graph], {3}]]}], {g, groups}];
lines = Cases[cp, {__, _Line}, Infinity]; (* only change *)
Graphics[GraphicsComplex[points, {regions, lines}],
Sequence @@ Options[cp]]
];
Possible duplicates:
Many related:
RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}]
. $\endgroup$