Mathematica: why 3D plot remember last viewpoint/r

2019-03-16 20:40发布

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.

3条回答
Emotional °昔
2楼-- · 2019-03-16 21:06

Try:

With PreserveImageOptions->False, settings for image options from the previous
version of a graphic are always ignored.
查看更多
老娘就宠你
3楼-- · 2019-03-16 21:18

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.

查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-03-16 21:24

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.

查看更多
登录 后发表回答