Cannot zoom into figures

46 views (last 30 days)
Justin Chan
Justin Chan on 3 Jul 2019
Commented: Matthew Cooper on 11 Oct 2020
I am running Matlab 2019a on Ubuntu 18.04.2.
I am simply trying to zoom into an ordinary figure, such as one produced by plotting random numbers:
figure
plot(randi([-5,5],1000,1));
When I run the script, the figure pops up.
I can select the zoom tool.
However, when I attempt to drag the zoom tool to create a bounding box, no box forms. And thus no zoom occurs. I am also unable to use the pan tool. However, the 'data tips' and 'data brush' tools work.
This has occured recently, I am not sure what has changed in my setup to have caused this.
I previously has Matlab 2018b, but the zoom has also spontaneously stopped to work. So I upgraded to Matlab 2019a. But the zoom still does not work.
As a result, I suspect there is something related to the underlying system that is causing this. I know this is not related to OS version, as zoom worked before on this same OS. Any ideas?
  1 Comment
Flavv
Flavv on 5 Nov 2019
Edited: Flavv on 5 Nov 2019
Same here with Matlab R2018b, it is impossible to zoom. My script was named "view.m". If I change its name, the zoom works.

Sign in to comment.

Answers (2)

Steven Lord
Steven Lord on 5 Nov 2019
Flavv,
The name view already has a meaning in MATLAB. The zoom function (which is called when you use the zoom button in the Figure window) does call view so your shadowing of this function could cause it to stop working if your view behaves differently than the view function included in MATLAB.
My suspicion is that between the last time it worked for Justin Chan and the first time it failed Justin introduced a script or function named view, zoom, or a similar function that shadows the version of that function included in MATLAB.
  2 Comments
Flavv
Flavv on 5 Nov 2019
Hi Steven, thank you for your answer. Yes, this is very possible!
However this is clearly a bug: the user is supposed to be free to choose any name for his scripts (or at least be warned of a naming problem when running the script).
Matthew Cooper
Matthew Cooper on 11 Oct 2020
Steven Lord's solution solved my problem. I had a function 'view'. When I removed it from my path, the zoom and pan tools worked again.

Sign in to comment.


Paul Macey
Paul Macey on 3 Dec 2019
I found this problem occurs in debug mode, when I also can't edit axes or save. I'm not sure if this is the same as earlier versions or not.

Categories

Find more on Visual Exploration in Help Center and File Exchange

Tags

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!