plot table with subplot

4 次查看(过去 30 天)
Giulio Vialetto
Giulio Vialetto 2018-11-5
Dear all,
I would like to plot a table of data into a figure with four subplots. I wrote this code but it doesn't work, any suggestion?
%
% Plot Heat consumption
%
data_display = DATA{DATA{:,{'FLAG'}} == 0,{'H_kW'}};
figure
title('Heat consumption - kW')
subplot(2,2,[1 3]);
histogram(data_display,n_obs);
set(gca, 'xScale', 'log');
title('Histogram heat cons. (kW)');
xlabel('Heat cons.');
ylabel('Num. of observations');
subplot(2,2,2);
title('QQplot heat cons.');
qqplot(data_display);
%
% Calculate pivot table of data
%
T_Heat = round(log10(DATA{index,{'H_kW'}}));
%
% Create index and count values
%
count_T_Heat = accumarray(T_Heat(T_Heat>0),1);
[row,~] = size(count_T_Heat);
index_T_Heat = zeros(row,1);
for i=1:row
index_T_Heat(i,1) = i;
end
%
% Create pivot table
T_Heat = uitable('Data',[index_T_Heat,count_T_Heat]);
T_Heat.ColumnName ={'Heat_cons_log_scale','Observation_count'};

回答(1 个)

Walter Roberson
Walter Roberson 2018-11-5
uitable ignores axes and so ignores subplot.
What you can do is subplot() anyhow, but then fetch the OuterPosition property. Use that as the Position of the uitable. You could delete the subplot axes afterwards.

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by