10

This has always bugged me and wondering if there is a fix.

When I evaluate a Plot3D I get a graph as expected. However, when I click the graph with the mouse it resizes to a smaller size. I can then rotate it freely. I find this behavior strange. I illustrated this in the gif below.

In addition, notice that if I evaluate Plot3D again, the image doesn't reset to the big size. I find this strange as well. Shouldn't it resize to big? I illustrated this toward the end of the gif.

  1. Can you explain why the image resizes to small upon clicking it with the mouse? What's the point of this?

  2. Can you explain why the image does not resize to large upon evaluating Plot3D the second time as shown in the gif? This doesn't make sense why it wouldn't reset like everything else.

  3. Is there a way to evaluate Plot3D in such a way that I get a fixed size graph that does not change when it is initially clicked by the mouse?

Thank you! I'm relatively new to Stack Exchange. Please let me know if there is anything I am doing that is not following protocol. Thank you!

Why does Plot3D Resize when clicked?

enter image description here

[![enter image description here][3]][3]

enter image description here

B flat
  • 5,523
  • 2
  • 14
  • 36
  • I'm on a mobile right now, so I can't test... But does specifying an ImageSize solve the issue? It's an option for Plot and the like – Lukas Sep 20 '15 at 20:14
  • Thanks Lukas. I tried that but didn't help. However, I noticed that if I added the option SphericalRegion->True I almost get what I want. See 2nd gif above. You'll notice it still moved the graph ever so slightly to the left when initially clicked. I would like no change at all. – B flat Sep 20 '15 at 20:21
  • So I did so more digging and may have answered my own question. If I add ImagePadding->1 and SphericalRegion->True for options it seems to work. It there a more efficient way? It seems like aesthetically the default option should be no resizing or shifting. – B flat Sep 20 '15 at 20:33
  • Have you tried the option RotationAction->"Clip"? I think this option without the others about would do it. – Edmund Sep 20 '15 at 20:52
  • Hi Edmund. Interesting. The RotationAction->Clip option fixes the initial resize action but the moment you try rotating the graphic the size jumps to a smaller size again. It looks like my solution above still stands. Any other ideas? – B flat Sep 20 '15 at 20:56
  • What version and OS are you using? I don't see this behaviour in 10.2 on Win 8.1 64-bit. I noticed you are on Mac so it maybe a platform specific issue. – Edmund Sep 20 '15 at 21:02
  • Hi Edmund. I'm running OS x 10.11 using Mathematica 10.1. I posted another gif above illustrating the behavior with RotationAction->Clip option enabled. I will try updating to Mathematica 10.2 today and see if that helps. Thank you! – B flat Sep 20 '15 at 21:07
  • Btw... is there a way to add gifs to comments like this one rather than having to edit my original post? I don't see an option next to this cell. – B flat Sep 20 '15 at 21:08
  • It might be a version issue. Also, I don't think you can add gifs to comments. Just things you can type. – Edmund Sep 20 '15 at 21:15
  • @MichaelMcCain You can upload the gif and include a link in comments, but you can't display an image in comments. – Michael E2 Sep 21 '15 at 10:42
  • I also do not observe the behavior in the gifs in V10.1 or 10.2, Mac OSX 10.10.5. The tick labels are sometimes repositioned when I let go of the mouse, though. The ImagePadding trick keeps that from happening, which has been my standard trick for years, now. – Michael E2 Sep 21 '15 at 10:49
  • 2021 and the bug is still not fixed. Wolfram is much like Bethesda: "It's a feature, not a bug." I do not believe there is any more than 5% of users who find the default behaviour to be sane. Rotating a plot one way and back again should invert that rotation-- restoring the original size of the image. – Myridium Nov 05 '21 at 00:34

1 Answers1

4

If you use both options and put Clip in double quotes, it works as desired. (Windows 7, Mathematica 10.2).

Plot3D[Sin[x y], {x, -3, 3}, {y, -3, 3}, RotationAction -> "Clip", SphericalRegion -> True]
JimB
  • 41,653
  • 3
  • 48
  • 106
  • Thank you. I did forget the quotes. : / I tried the quotes and I'm getting a slight move to the left still. My only fix so far is to add ImagePadding->1. I'm running Mathematica 10.2 now. It seems this may be compatibility issue in OS X. I added a gif using your code and what I see above. @Jim – B flat Sep 20 '15 at 21:58
  • @MichaelMcCain. Well, maybe I overstated with "works as desired." No resizing but there is the small shift to the left as you describe (again with Windows 7 and Mathematica 10.2 - so probably not an OS X issue). Adding in ImagePadding -> 1 does complete things as you suggested. – JimB Sep 20 '15 at 22:42
  • @MichaelMcCain. I think I need to withdraw my answer. It appears that just SphericalRegion->True is needed to keep things from resizing on the first time executing with a fresh kernel. The small shift to the left only occurs the first time one executes the command. That coupled with the position drawn being the same from what remained from the previous execution suggests that some parameter is not being initialized on the first execution. This would seem to call for folks more knowledgeable about the inner workings of Mathematica than me (which is nearly everybody). – JimB Sep 20 '15 at 23:07
  • Thank you for troubleshooting with me. @Jim – B flat Sep 21 '15 at 04:05