Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

I would like to create a stereogram from a 3d plot; I would like to export two images of a 3d plot at a slightly different angle, so that when each picture is presented to a different eye, one gets the feeling it is actually 3 dimensional.

I have tried to put two plots next to eachother, then turn one plot slightly by hand (mouse), but when I then export, it is as if I hadn't turned the plot at all!


s1 = 
  Plot3D[PDF[MultinormalDistribution[{0, 0}, {{1, 1/2}, {1/2, 1}}], {x, y}],
    {x, -2.3, 2.3}, {y, -2.3, 2.3}]
Show[GraphicsArray[{s1, s1}]]

How can I specify at which angle the 3d plot is exported?

PS: Just to be clear: I don't want to rotate the function which is plotted, I want to rotate the plot, including the edges of the bounding box of the plot.

share|improve this question

marked as duplicate by m_goldberg, Sjoerd C. de Vries, RunnyKine, Simon Woods, belisarius has settled May 21 '14 at 17:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Have you checked ViewVector? – Öskå May 21 '14 at 12:36
Seems to work. Why isn't it in the documentation of Plot3D? – Angelorf May 21 '14 at 12:39
It is in Options@Plot3D at least.. :) – Öskå May 21 '14 at 12:39
I see. I didn't know the possibility to do Options@ yet. Thanks. – Angelorf May 21 '14 at 12:42
Some graphics options appear only in the documentation of Graphics3D. – Michael E2 May 21 '14 at 14:18

1 Answer 1

Here is a small tool make it easier thanks to that answer:

With[{dplot = 
     Plot3D[PDF[MultinormalDistribution[{0, 0}, {{1, 1/2}, {1/2, 1}}], 
       {x, y}], {x, -2.3, 2.3}, {y, -2.3, 2.3}, ImageSize -> 350, 
       ViewVector -> Dynamic@vp]},
 DynamicModule[{vp, views, plot},
     Button["Record View point", AppendTo[views, vp]], 
     Button["Export", {Export["~/test.pdf", GraphicsRow[plot /@ views]]; 
       extViews = views}]}, Center],

   Initialization :> (
     extViews = 0;
     views = {};
     plot = 
     Plot3D[PDF[MultinormalDistribution[{0, 0}, {{1, 1/2}, {1/2, 1}}], 
       {x, y}], {x, -2.3, 2.3}, {y, -2.3, 2.3}, ImageSize -> 350, 
       ViewVector -> #] &;
    vp = Options[Graphics3D, ViewPoint][[1, 2]];

enter image description here


enter image description here

My problem here is that I have to write twice the Plot3D, one with Dynamic@vp one with #. If anyone can enlighten me.. :)

share|improve this answer
I suppose you could store the plot in a variable and then use Show to change ViewVector. But your code doesn't work for me because of problems with the syntax. – Pickett May 21 '14 at 14:29
@Pickett dangdang, thanks for telling me! – Öskå May 21 '14 at 14:34
It works for me (MMA 9). – corey979 Apr 10 at 17:13
@corey979 I'm glad it does, I did use v8 if I remember correctly :) – Öskå Apr 10 at 18:10

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