Dynamically reorder subplots in GUI
Show older comments
Hello everyone,
I'm developing a GUI using GUIDE. The functionality I want to achieve implies that when the user clicks a button, a new subplot is added to a parent figure. I have managed to structure the subplots in a square layout (for instance, if the user clicks the button 9 times, 9 plots are displayed in 3 rows and 3 columns.) However, everytime a new subplot is added, I delete all the subplots handles and re-create them to include the new one. This isn't the desired behaviour since I just want to reorder the subplots (change their position) in figure in a fair enough square layout. Any help would be appreciated.
5 Comments
What exactly is the problem? If you do not want to delete the axes, what about not deleting them, but assigning the new position? If you post your current code, suggestion the small modification would be easier.
What do you want for 3 axes? A 2x2 array with an empty field, or a 1x3 or 3x1 setup?
Adam
on 28 Jun 2017
To be honest you would be better off doing something as dynamic as this programatically and using just regular axes that you position mathematically according to an algorithm dependent on how many there are.
I have done something similar with panels of images. It took a fair bit of programming, but it worked at least. I never dynamically moved them after creating them, but I could do easily enough if I wanted because they were dynamically created in the first place.
Lask
on 28 Jun 2017
Adam
on 28 Jun 2017
Well, by programmatically I was mostly referring to positionining axes explicitly based on an algorithm that calculates the positions for a grid of whatever size you give it.
subplot is limited if you use that and you have little choice but to keep deleting and recreating axes. I don't fully understand what your workflow is as to what is on these axes, but if you are just wanting to add a new axes deleting and recreating the existing 9 is certainly not very efficient.
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!