8

Bug fixed in 9.0.1


When I export the result defined as the variable pot1 to pdf, the lower contour plot isn't showing. How do I fix this?

potential1 = 
  Plot3D[-3600. h^2 + 0.02974 h^4 - 5391.90 s^2 + 0.275 h^2 s^2 + 0.125 s^4,
    {h, -400, 400}, {s, -300, 300},  PlotRange -> {-1.4*10^8, 2*10^7}, 
    ClippingStyle -> None, MeshFunctions -> {#3 &}, Mesh -> 10, 
    MeshStyle -> {AbsoluteThickness[1], RGBColor[0, 0, 1]}, 
    Lighting -> "Neutral", MeshShading -> {{RGBColor[0, 0, 1]}, {RGBColor[1, 1, 1]}}, 
    Boxed -> False, Axes -> False];

potContPlot1 = 
  ContourPlot[-3600. h^2 + 0.02974 h^4 - 5391.90 s^2 + 0.275 h^2 s^2 + 0.125 s^4,
    {h, -400, 400}, {s, -300, 300}, PlotRange -> {-1.4*10^8, 2*10^7}, 
    ClippingStyle -> None, MeshFunctions -> {#3 &}, Contours -> 10, 
    ContourStyle -> {{AbsoluteThickness[1], RGBColor[0, 0, 1]}}, 
    ContourShading -> {{RGBColor[.5, .5, 1]}, {RGBColor[.7, .7, 1]}}, 
    Axes -> False, Frame -> False];

potFace1 = 
  Graphics3D[{EdgeForm[], Texture[potContPlot1], 
    Polygon[{{-400, -200, -2.0*10^8}, {400, -200, -2.0*10^8},
             {400, 200, -2.0*10^8}, {-400, 200, -2.0*10^8}}, 
      VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}];

pot1 = 
  Graphics3D[{potential1[[1]], potFace1[[1]]}, 
    Lighting -> "Neutral", BoxRatios -> {1, 1, .7}, Boxed -> False];

Export["pot.pdf", pot1]
QuantumDot
  • 19,601
  • 7
  • 45
  • 121

1 Answers1

9

This is due to a bug in Texture. According the docs, Texture[obj] is equivalent to Texture[Rasterize[obj]] (and you're understandably making use of that). However, unfortunately Texture only works properly when you do Texture[ImageData@Rasterize[obj]] instead. This means that in your shortened form without explicit Rasterize, the ImageData isn't being extracted correctly. So what you should do is simply this little change:

potFace1 = 
  Graphics3D[{EdgeForm[], Texture[ImageData[Rasterize[potContPlot1]]],
     Polygon[{{-400, -200, -2.0*10^8}, {400, -200, -2.0*10^8}, {400, 
       200, -2.0*10^8}, {-400, 200, -2.0*10^8}}, 
     VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}];

With this, the export will work correctly.

For reference, here is a link to an earlier question where this also appeared:

Textures are not rendered in combined graphics

Jens
  • 97,245
  • 7
  • 213
  • 499
  • Thanks, I have made additional variations on my plot, but now the exported file looks too dark? Would you take a look at my follow-up question? http://mathematica.stackexchange.com/questions/14905/exported-graphics-texture-to-eps-is-too-dark – QuantumDot Nov 19 '12 at 22:33