plot table with subplot
조회 수: 9 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!