8
$\begingroup$

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]
$\endgroup$

1 Answer 1

9
$\begingroup$

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

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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