Reputation: 31
I wrote a GUI, and I want to plot on the right hand side.
It is not like subplot(2,2,2)
or something like that, because I want to plot it on right hand side not on the top of right side. Also it is not like subplot(1,2,2)
.
How to do this?
I can not find any handle of a gcf.
Upvotes: 0
Views: 406
Reputation: 929
It depends if you want to create axes
on the right side of the gui or, if you want to subplot thoses axes. The following answer does both.
// Lets define a figure with a gridbag layout
fig=figure('layout','gridbag')
// Lets define a frame
frameleft=uicontrol(fig,..
'style','frame',..
'BackgroundColor',[0.2,0.2,0.8],.. // blue so visible
'constraints',createConstraints("gridbag", [1,1,1,1],[1,1],'both','center')) // make it use all the available space
// lets define a right frame : just position it a x = 2, this
// will move frameleft to the left
frameright=uicontrol(fig,..
'style','frame',..
'BackgroundColor',[0.2,0.8,0.2],.. // green
'constraints',createConstraints("gridbag", [2,1,1,1],[1,1],'both','center')) // all the available space from x=2
// then to plot, lets create axes relatives to frameright
a = newaxes(frameright)
// Then all commands works as usual
title('Title')
subplot(1,2,2)
plot2d()
produces
Upvotes: 1