Mathematica: why 3D plot remember last viewpoint/rotation made to it, even after evaluating again?

心已入冬 提交于 2019-12-20 17:26:33

问题


I find this a bit annoying.

I make a 3D plot, initially it come up in the default orientation. Then, using the mouse, I rotate it some way.

Now I run the command again, expecting to obtain the original shape (i.e the original orientation before I rotated it by mouse), but instead, it just gives me the same plot I have on the screen, i.e. it seems to have kept/remembered the last viewpoint in that output cell.

I wanted it to go back to the original viewpoint. So, I delete the output cell to make it happen.

Do you think this is how it is supposed to work? Having to keep deleting the cell output is annoying when I am trying thing. I think it should go back to original default orientation.

  Graphics3D[ Cuboid[{-.1,-.1,-.1},{.1,.1,.1}],
        AxesOrigin->{0,0,0},
        PlotRange->{{-1,1},{-1,1},{-1,1}},
        Axes->True,
        AxesLabel->{"X","Y","Z"},
        Ticks->None]

If you run the above, then move the plot, then run the command again, you'll see what I mean.

version 8.0.01

EDIT:

More strange: I added viewpoint option to force it to the default view point, yet, the same result. It remember the last viewpoint. This below is the default viewpoint, from help.

 Graphics3D[ Cuboid[{-.1,-.1,-.1},{.1,.1,.1}],
        AxesOrigin->{0,0,0},
        PlotRange->{{-1,1},{-1,1},{-1,1}},
        Axes->True,
        AxesLabel->{"X","Y","Z"},
        ViewPoint->{1.3,-2.4,2},
        Ticks->None]

I find this strange.


回答1:


Try:

With PreserveImageOptions->False, settings for image options from the previous
version of a graphic are always ignored.



回答2:


In a Mathematica notebook, render your plot, then orient it the way you like.

Then place the cursor on the left of the PLOT OUTPUT, and type "AbsoluteOptions[" Then place the cursor on the right of the PLOT OUTPUT, and type "]" Shift-Enter

You will get a bunch of information. Look for ViewPoint and then use this as an option in your graphics. Then, you will always get the same orientation.




回答3:


I like to think of re-running the Plot command as updating the graphic I have already created. After all, it does not make a second plot.

From this perspective, if I rotate or size my graphic, I do not want Mathematica to mess with that when I add a label or change a style.

However, if I delete my graphic to start over, Mathematica uses the default rotation and size.

Therefore, I find the behavior logical and appreciated.



来源:https://stackoverflow.com/questions/6181944/mathematica-why-3d-plot-remember-last-viewpoint-rotation-made-to-it-even-after

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!