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.

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]
share|improve this question

1 Answer 1

up vote 8 down vote accepted

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

share|improve this answer
    
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? mathematica.stackexchange.com/questions/14905/… –  QuantumDot Nov 19 '12 at 22:33

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.