
How to plot 4 different backgrounds in a figure?
13 ビュー (過去 30 日間)
古いコメントを表示
Diego Alberto León López
2020 年 10 月 21 日
コメント済み: Diego Alberto León López
2020 年 11 月 21 日
Hello, im trying to change the background of a figure, i need to have it divided in four sections and then add them a background color, just as i show in the picture.
Hope someone can help me. Thanks.

0 件のコメント
採用された回答
Akira Agata
2020 年 10 月 30 日
How about using uipanel?
The following is an example:
% Sample colormap
cMap = rand(4,3);
% Graphic object array
hPanel = gobjects(4,1);
hAxes = gobjects(4,1);
hPlot = gobjects(4,1);
% Relative position of each panel
[x,y] = meshgrid([0 0.5]);
x = x(:);
y = y(:);
% Create the desired plot
hFig = figure;
for kk = 1:4
hPanel(kk) = uipanel(...
'Parent', hFig,...
'Units', 'normalized',...
'Position', [x(kk) y(kk) 0.5 0.5],...
'BackgroundColor',cMap(kk,:));
hAxes(kk) = axes(...
'Parent', hPanel(kk));
plot(hAxes(kk),magic(4));
end

その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!