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.

Why is the exported graphics eps file so dark? It looks much lighter (and better) as the Mathematica output appearing the notebook.

After running

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}];

and then trying to export

contourPotentialPlot2 = 
 ContourPlot[-3600. h^2 + 0.0297 h^4 - 5391.9 s^2 + 0.275 h^2 s^2 + 
 0.375 s^4, {h, -400, 400}, {s, -300, 300}, 
 PlotRange -> {-1.4*10^8, 2*10^7}, Contours -> 15, 
 ContourStyle -> AbsoluteThickness[1], Axes -> True, Ticks -> None, 
 AxesStyle -> AbsoluteThickness[3], PlotPoints -> 30, 
 PlotRangePadding -> 0, Frame -> False, 
ColorFunction -> "BrassTones"];

potential2 = 
  Plot3D[-3600. h^2 + 0.0297 h^4 - 5391.9 s^2 + 0.275 h^2 s^2 + 
  0.375 s^4, {h, -400, 400}, {s, -300, 300}, 
  PlotRange -> {-1.4*10^8, 2*10^7}, ClippingStyle -> None, 
  MeshFunctions -> {#3 &}, Mesh -> 15, 
  MeshShading -> {{RGBColor[1, 1, 0]}, {RGBColor[1, 1, 1]}}, 
  Lighting -> "Neutral"];

level = -1.4 10^8; 
gr = Graphics3D[{Texture[ImageData[Rasterize[contourPotentialPlot2]]], 
  EdgeForm[], Polygon[{{-400, -300, level}, {400, -300, level}, {400, 300, 
  level}, {-400, 300, level}}, 
  VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}, 
  Lighting -> "Neutral"];

pot2 = Show[potential2, gr, PlotRange -> All, BoxRatios -> {1, 1, .5},
  FaceGrids -> {Back, Left}, Axes -> None, Boxed -> True, 
  Lighting -> "Neutral"]
Export["pot2.eps", pot2]

It looks like the first image below in the notebook file, but as an exported eps file, looks much darker as in the second image. How do I fix this?

Mathematica output Output file

share|improve this question
    
There's a Background option to Rasterize, I think, which might remove that grey rectangle when set to None. However this problem looks quite complex, with that "bitmap eps" code, so I think Jens has the best chance of helping you... –  cormullion Nov 20 '12 at 16:31
add comment

1 Answer 1

up vote 4 down vote accepted

I'm not quite sure why this happens, but it does look like the natural lighting isn't applied correctly when exporting to EPS or PDF. It does work when I export to PNG. However, for your purposes it's not too hard to work around that: just give the 2D part of your plot a glow of its own which overrides any lighting:

gr = Graphics3D[{Glow[White], 
     {Texture[ImageData[Rasterize[contourPotentialPlot2]]], 
     EdgeForm[], 
     Polygon[{{-400, -300, level}, {-400, 300, level}, {400, 300, 
        level}, {400, -300, level}}, 
      VertexTextureCoordinates -> {{0, 0}, {0, 1}, {1, 1}, {1, 0}}]}, 
    Lighting -> "Neutral"}];

The only thing I changed in your code is the first line above. With this, I get the expected output without the darkened shadowing effect on the polygon.

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.