Resizing GUI Plots (Copied Into New Figure Window)

3 visualizzazioni (ultimi 30 giorni)
Hi,
I have a program with a results GUI window that allows the user to plot 6 different variables on each of three different graphs.
These are quite small to fit on the GUI. I want them to appear like a 1x3 column subplot, in a new full sized figure window when a button is pressed.
I have copied the plots (I don't want to re-plot them based on the users radio button choices - too many combinations possible) and put them in a new figure window.
They are shown in the new figure window the same size as the GUI version though... how can I make these fit the figure window?
Code so far:
set(0,'showhiddenhandles','on') % Make the GUI figure handle visible
AxesInGUI = findobj(gcf,'type','axes') % Find the axes object in the GUI
% Open a new figure with handle NewFig
scrsz = get(0,'ScreenSize');
NewFig = figure('Position',[0 0 scrsz(3) scrsz(4)],'Color',[0.95 0.95 0.95])
% Copy axes object AxesInGUI into figure NewFig
CopiedObjects = copyobj(AxesInGUI,NewFig)
Thanks in advance, Matt.
  1 Commento
Adam
Adam il 21 Ott 2016
Can't you just resize the axes by changing the 'Position' property?

Accedi per commentare.

Risposta accettata

Matt
Matt il 24 Ott 2016
I have figured this out. Solution below for anyone who needs to do this in the future...
  • I copy the plots the user has selected to plot (using the many radio buttons) on the GUI using findobj. This puts them in a 3x1 Axes Array.
  • Then I make a new figure window.
  • Next I copy the plots found using findobj by using copyobj, into the new figure window. This puts them in a new 3x1 Axes Array.
  • I hadn't understood how this all worked, but once I did I realised I could manipulate each plot stored in the new 3x1 Axes Array individually then it was possible to space them out correctly (again - as they were on the GUI) but make them larger.
set(CopiedObjects(1,1), 'Position', [15 4 360 18]);
set(CopiedObjects(2,1), 'Position', [15 28.5 360 18]);
set(CopiedObjects(3,1), 'Position', [15 53 360 18]);
This places each plot in a line vertically (15 units from the left border) and then spaces them out on the screen (4/28.5/53 units up from the lower border) keeping them all 360x18 in size.
I hope this helps someone one day - it had me stumped for ages.
Thanks for the suggestion Adam. I had tried that with no success but I have got it sussed now.

Più risposte (0)

Categorie

Scopri di più su Graphics Object Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by