Writing:
plot = ParametricPlot[{x, Min[1, 2] t}, {x, 0, 2}, {t, 0, 1},
PlotRange -> {{0, 2}, {-1, 2}}]
I get:
but if I write:
Export["test.pdf", plot]
I get:
How can I get the same image in test.pdf
?
UPDATE: See more general solution in this answer.
You can solve this problem by joining the polygons using undocumented function Graphics`PolygonUtils`PolygonCombine
:
plot = Normal@
ParametricPlot[{x, Min[1, 2] t}, {x, 0, 2}, {t, 0, 1},
PlotRange -> {{0, 2}, {-1, 2}}] /.
p : {__Polygon} :> Graphics`PolygonUtils`PolygonCombine[p];
Export["test.pdf", plot] // SystemOpen
Here is how the file is rendered by Adobe Acrobat:
(checked with version 11.1.0).
Another workaround is to remove transparency from the polygons by specifying the PlotStyle
explicitly:
plot = ParametricPlot[{x, Min[1, 2] t}, {x, 0, 2}, {t, 0, 1},
PlotRange -> {{0, 2}, {-1, 2}}, Mesh -> None,
PlotStyle -> RGBColor[{0.812, 0.851, 0.914, 1}]]
Now the PDF
Export["test.pdf", %] // SystemOpen
is rendered as
plot = Plot[1, {x, 0, 2}, PlotRange -> {{0, 2}, {-1, 2}}, Frame -> True, Filling -> Axis, AspectRatio -> 1.5,PlotStyle -> Thin]
$\endgroup$FixPolygons
package for joining the polygons. $\endgroup$Min[1, 2] t
? Surely that can be replaced byt
alone? Or doesn't the problem reproduce then? $\endgroup$SetSystemOptions["VisualizationOptions" -> {"GraphicsComplexPolygonCombine" -> True}];plot = ParametricPlot[{x, Min[1, 2] t}, {x, 0, 2}, {t, 0, 1}, PlotRange -> {{0, 2}, {-1, 2}}];Export["test.pdf", plot]
works in your version/OS? $\endgroup$