How to have three figures side-by-side to create one composite figure?

Hi guys,
A basic question. I have the below test input. I want to put the three generated figures side-by-side and export it as one image like I am doing now. But I want these figures to be side-by-side and have some form of a border/separation/panel between them? I want to create ONE horizontal figure composed of these three 'sub-figures' (i.e., a composite figure).
Thank you
figure(1)
surf(peaks);
colormap(winter);
title('FIGURE 1A', 'FontSize', 12, 'fontweight', 'bold')
figure(2)
surf(peaks);
colormap(autumn);
title('FIGURE 1B', 'FontSize', 12, 'fontweight', 'bold')
figure(3)
surf(peaks);
colormap(spring);
title('FIGURE 1C', 'FontSize', 12, 'fontweight', 'bold')
export_fig FIGURE_1.tiff -m3 -q101 -nocrop

 採用された回答

Image Analyst
Image Analyst 2015 年 5 月 10 日

1 投票

Try this:
h1 = subplot(1,3,1);
surf(peaks);
colormap(h1, winter);
axis square;
title('FIGURE 1A', 'FontSize', 12, 'fontweight', 'bold')
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
h2 = subplot(1,3,2);
surf(peaks);
axis square;
colormap(h2, autumn);
title('FIGURE 1B', 'FontSize', 12, 'fontweight', 'bold')
h3 = subplot(1,3,3);
surf(peaks);
colormap(spring);
axis square;
title('FIGURE 1C', 'FontSize', 12, 'fontweight', 'bold')

5 件のコメント

A
A 2015 年 5 月 10 日
That's great. Thanks so much.
1) Is there a way to add borders/divisions/panels between them?
2) They appear a bit 'squarish'. Is there a way to maintain aspect ratio?
Sean de Wolski
Sean de Wolski 2015 年 5 月 10 日
編集済み: Sean de Wolski 2015 年 5 月 10 日
For aspect ratios:
doc daspect
As for borders, you could embed them in uipanel-s but that is an extra level of work.
Image Analyst
Image Analyst 2015 年 5 月 10 日
Or you could try axis equal, or just remove the axis square line. Or you could use
set(h1, 'OuterPosition', [x,y,width, height]);
Note to others, different colormaps are allowed only in R2014b and later.
If this answers your question, you could vote for it and officially mark it as "Accepted".
A
A 2015 年 5 月 10 日
Thanks for the solutions.
So there really isn't a good way to just put a line between 1A and 1B?
Image Analyst
Image Analyst 2015 年 5 月 11 日
I don't see that line() can draw lines on the figure itself so I think you have to use a panel, which has a line around it. Set the string property to null so no words show up on the line. That should work, though you can't use subplot - you'll probably have to use GUIDE or else do it yourself with some difficulty using uicontrol().

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Color and Styling についてさらに検索

質問済み:

A
A
2015 年 5 月 10 日

コメント済み:

2015 年 5 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by