I have used several axes in different tabs within layouts. I needed the ability to do plotyy type plotting as well. My workaround is to place all axes inside a uipanel. This way the uipanel acts as a container for the axes. This also allows the panel to have multiple overlapping children without the uitab's layout separating them into its layout.
This is what I was looking for, but I had to fix it to work well for axes embedded in complicated layouts involving uipanels, uitabs, etc. I use the excellent GUI Layout Toolbox from here on the file exchange to have lots of resizeable panels for example.
The problem is that this function assumes the legend should be placed relative to the figure. Unfortunately if a nested uipanel is used as a reference, the getpos() function does not correctly return the figure coordinates relative to the anchor. To get the global figure coordinates for a nested object, the GUI's hierarchy must be traversed, and the left and bottom coordinates summed for each parent up to the figure level. Each control's position is relative to it's parent, not to the figure.
Fortunately there's a simpler solution. I made the legend a child of the 'ref' object and fixed anywhere that temporary axes were made to the figure to be to the ref object instead. I also added a check that if this parent object is an axes, to get it's parent since the legend axes can't be a child of another axes. Finally, in the case of a plot in a densely nested GUI, the resize function should be on the parent component, not on the entire figure. This way when I drag the boundaries between uipanels to resize them, the legend and axes resize with them. I'm still experimenting with it, but this seems to solve my problems thus far.
I'll wait on permission to post my code since the author listed a copyright in the source.
Have you read "readme.txt" file in "patch" folder, where p-file you've mentioned is located?
It mostly explains why they are there.
It looks like these files are fixed versions of core matlab functions, so developers won't release source code for them. Just hope that those issues would be removed some time.
It's easy to use, however, I've been facing same problem while trying to compile this GUI into standalone application.
When attempting to compile some of your code, warnings are given relative to the P-files missing their associated M-Files.
Here is one example :
Warning: Requirements cannot analyze P-code unless the user provides a corresponding M-code along with the P-code in the
same folder. The dependencies of D:\Codes\MATLAB\GUILayout-v1p14\Patch\getpixelposition.p may not be included in the
completion because its corresponding M-code cannot be found by REQUIREMENTS.
I was wondering if there's any workaround, or if you can release the m-code. Since the main reason to write a gui is to distribute it through standalone projects. Thanks for helping in advance.
There is a small "bug" that makes this package incompatible with the Matlab "Application compiler" app for redistributing compiled stand alone applications.
A work around is the following:
The problem lies with the image locations being hard-linked to the location of the package from the use of "fileparts". I replaced these lines with a test for "isdeployed", for example lines 424/5 of uiextras.TabPanel (iLoadIcon function) to:
this_dir = fileparts( mfilename( 'fullpath' ) );
icon_dir = fullfile( this_dir, 'Resources' );
this_dir = '.';
icon_dir = '.';
I then simply include the resource files in the list of additional files in the app.
Great way to plot graphs in different tabs. Highly recommended.
Note: There is a small bug with graphs from different tabs being plotted on top of each other. This can be fixed using uipanel for each graph (instead of uicontainer). See comments below from @eff and @Brett 22nd Aug 2013.