I have the following simple Mathematica code:
Clear["Global`*"];
x = Cos[t];
y = Sin[t];
L1 = ParametricPlot3D[{x, y, t}, {t, 0, 50},
PlotStyle -> {Blue, Thickness[0.003]}, Axes -> True,
AxesLabel -> {"x", "y", "t"}, BoxRatios -> {1, 1, 1},
AxesStyle -> Directive[Black, FontSize -> 17, FontFamily -> "Helvetica"],
PlotPoints -> 500, PlotRange -> All, ImageSize -> 500];
L2 = Graphics3D[{EdgeForm[None], Opacity[0.2], GrayLevel[0.1],
Specularity[White, 20], Mesh -> None, Lighting -> None,
Cuboid[{-1, -1, 38}, {1, 1, 50}]}];
P1 = Show[{L1, L2}, ViewPoint -> {1.3, -2.4, 1.5}]
However, when I try to export this three-dimensional plot in eps format, all the part of function which is inside the cuboid, that is when z>38 does not appear. It seems that somehow during the export the options Opacity
is overruled. Is there a way to export this plot correctly?
Answer
If you want to make sure that all exported EPS
will look fine even without explicitly rasterizing the plot every time, you can force the rasterization by this one-time command that you could put at the beginning before creating any of your plots:
Map[SetOptions[#,
Prolog -> {{EdgeForm[], Texture[{{{0, 0, 0, 0}}}],
Polygon[#, VertexTextureCoordinates -> #] &[{{0, 0}, {1,
0}, {1, 1}}]}}] &, {Graphics3D, ContourPlot3D,
ListContourPlot3D, ListPlot3D, Plot3D, ListSurfacePlot3D,
ListVectorPlot3D, ParametricPlot3D, RegionPlot3D, RevolutionPlot3D,
SphericalPlot3D, VectorPlot3D, BarChart3D}];
The trick is explained in this answer and the linked ones. You're asking about transparency in particular, so I guess it's not quite a duplicate question, but a duplicate answer...
The plots will be rasterized when exporting to PDF
or EPS
- the notebook internal plots are not rasterized.
Comments
Post a Comment