plot table with subplot
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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'};
0 Kommentare
Antworten (1)
Walter Roberson
am 5 Nov. 2018
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!