Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
To fill all the space above the plane z=38 replace your L2 with L2 = Graphics3D[{Opacity[0.2], GrayLevel[0.1], Lighting -> None, Cuboid[{-1, -1, 38}, {1, 1, 50}]}]. –  VLC Jan 9 '13 at 13:45
    
@VLC Great! Using the Cuboid the issue regarding the dark output is solved. However, when I export the .eps file the part of the function inside the Cuboid (that is when z>38) is not shown as if there was no Opacity. Any ideas about that? –  Vaggelis_Z Jan 9 '13 at 14:26
    
I think that the issue is related to the fact that EPS does not support true transparency (see here) –  VLC Jan 9 '13 at 16:06
    
@VLC Very illuminating piece of information. Does this mean that there is no way to export this plot correctly? Should I edit and rename my post here? –  Vaggelis_Z Jan 9 '13 at 16:11
    
However, if you export to PDF, the transparency will be preserved. In many places where one wants EPS, e.g., for use in LaTeX, you can often use PDF just as well. –  murray Jan 9 '13 at 16:30
show 4 more comments

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.