Filter löschen
Filter löschen

App UIAxes Zoom Control

7 Ansichten (letzte 30 Tage)
Tom Paraschuk
Tom Paraschuk am 9 Feb. 2019
Kommentiert: Rik am 10 Nov. 2021
Hi everyone
I'm having troubling controlling the zooming of UIAxes in an app I'm desiging. The app has several buttons that generate different graphs. The way it should work is to make the x and y scale tight around the graphs each time a new graph is produced on the axes. I have been unable to achieve this behaviour, because if a user zooms in on a graph, I have found no good way to reset the zoom to make it tight around the next graph.
Some things I've tried are:
  • recreating the graph each time. this worked but it's slow and glitchy when the app is resized
  • set(app.UIAxes, 'XLimSpec', 'Tight'); set(app.UIAxes, 'YLimSpec', 'Tight');. - this has no perceivable effect on the user's zoom
  • zoom(app.UIAxes, 'RESET'); - this didn't compile, even though zoom(app.UIAxes, 'ON'), did compile
I'd be grateful if someone has the solution to this.

Antworten (1)

Subhamoy Saha
Subhamoy Saha am 14 Aug. 2020
As far I have understand, you are facing problem is the new plot appears in the axes limits for the previous zoom state.
You can try adding the following line after your plot command.
axis(app.UIAxes, 'tight')
This will make the axes tight about new set of data you are plotting each time.
  1 Kommentar
Rik
Rik am 10 Nov. 2021
Regarding your flag ("Fix the size during zooming"): flags are not personal bookmarks, but are meant to attract the attention of site admins.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by