2
$\begingroup$

I am trying to Rotate a 3DPlot around the z-axis (in the horizontal plane). This is what I believed would work, but I think I misunderstood how Rotate works. When I change the vector {0,0,1} to {1,1,1}, nothing happens. When I change the amount of degrees, it rotates in the wrong way. If I am not wrong, ViewPoint keeps the point of view constant. I think the key is actually in the ViewPoint. Changing the first component of the vector in ViewPoint helps to have the desired rotation, but the issue is now that I get a strong zoom which I do not want. A picture below shows what I would like to achieve, keeping sizes constant.

 Rotate[Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi},ViewPoint->{1,1,1}], 70 Degree, {0, 0, 1}]

I believe Rotate is turning the whole image, not the single plot inside the square containing the plot.

enter image description here

$\endgroup$
9
  • $\begingroup$ This is 2D case but the answer should fit here perfectly: mathematica.stackexchange.com/q/44748/5478 $\endgroup$
    – Kuba
    May 8 '17 at 9:37
  • $\begingroup$ @Kuba what I want is the Plot to be make a revolution $\endgroup$
    – Andrea G
    May 8 '17 at 9:39
  • 1
    $\begingroup$ Is this Graphics3D[Rotate[plot[[1]], 70 Degree, {0, 0, 1}], Sequence @@ Rest@plot] what you need? Then yes. $\endgroup$
    – Kuba
    May 8 '17 at 10:00
  • 1
    $\begingroup$ Add PlotRange -> All to Graphics3D. $\endgroup$
    – Kuba
    May 8 '17 at 10:24
  • 1
    $\begingroup$ Not true, you just need to put it before Sequence.. because the first option takes precedence $\endgroup$
    – Kuba
    May 8 '17 at 10:38
2
$\begingroup$

Answer from Issue in displaying a rotated PolarPlot with Show used for this specific case:

plot = Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, 
  ViewPoint -> {1, 1, 1}]

enter image description here

Graphics3D[Rotate[#, 70 Degree, {0, 0, 1}], 
   PlotRange -> All, ##2] & @@ plot

enter image description here

$\endgroup$
2
  • $\begingroup$ when adding another function, say Cos[x y], and including PlotLegends, I get an error saying "Graphics is not a Graphics3D primitive or directive". How to include the Legends in Graphics? $\endgroup$
    – Andrea G
    May 8 '17 at 11:12
  • $\begingroup$ I realized now that what I actually wanted is rotating the whole box in which the 3DPlot is contained. This code is allowing rotation of the 3DPlot with respect to an axis defined within the 3DPlot itself. I would like to rotate the whole box, again with respect to the axis defined within the 3DPlot. How? $\endgroup$
    – Andrea G
    May 8 '17 at 14:30

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