I realized after posting that my last question didn't make any sense, because it related to behavior that I thought was stock Matlab, but actually is not. I have another question, though. I'm trying to layout a plot and a uitable, and make it possible to print to a pdf that looks like the graphics on screen. However, while the on-screen display looks good, the table covers up part of the plot in the pdf. Is there any way to print to a vector pdf so it looks exactly like what I see on screen?
Thanks in advance for your help.
Here's the script I'm using:
X = randn(100,3);
summaryStats = [mean(X); std(X); min(X); median(X); max(X)];
Like subplot, but easier, and WYSIWYG export to file. Also fixes dashed/dotted lines in export.
Author: Ben Mitch
I'm having a little trouble setting up the layout I want, that includes a plot above and a data table below. The two main goals are:
1. Let the plot take up as much space as possible without cutting off any of the table
2. When the window is resized, resize the plot but leave the height of the table fixed.
Below is what I have so far, but I have to fudge the height of the table, and the resizing doesn't work because I don't know how to access the properties of my uipanel and uitable from inside a callback function.
Can anyone please provide some guidance?
% Create some data and a table
X = randn(100,3);
tableData = [mean(X,1); std(X,,1)];
% Set up the figure
set(f, 'units', 'normalized');
% Create the uipanels
u1 = uipanel('units', 'normalized', 'position', [0 0 1 1], 'backgroundcolor', [1 1 1]);
u2 = uipanel();
% Create the uitable and get the relevant sizes
tab = uitable('Parent', u2, 'Data', tableData, 'units', 'normalized', 'position', [0 0 1 1]);
pos = get(u2, 'position');
ext = get(tab, 'extent');
set(u2, 'position', [pos(1:3) ext(4)]);
% Set up the panel
p = panel(u1);
p.margin = [5 5 5 5];
% Pack two subpanels, with the bottom panel's height fixed (to hold the
% Can I automatically account for the margins without having to add a
% buffer like this?
% Add the plot
% Add u2
% Get rid of the scrollbars
jtab = findjobj(tab);
set(jtab, 'VerticalScrollBarPolicy', 21);
set(jtab, 'HorizontalScrollBarPolicy', 31);
% If I set up a call back, how do I access the position of u2 and the
% extent of tab from the 'data' argument?
I've just started using this toolbox, and it looks great. One question: it looks like the standard Matlab rollover functionality (i.e. showing the values on the plot under the mouse) is working for only the last plot added. Is there any way to get it to work for all plots in a figure?