How to plot four subfigures in one figure? Rather than subplot

2 ビュー (過去 30 日間)
Yuchi Kang
Yuchi Kang 2019 年 4 月 4 日
コメント済み: dpb 2019 年 4 月 4 日
Dear all
I want to draw a figure like this. Four subfigures merged into one figure. They are separated by a dashed line. Line 1 to 4 are imported. And X-axis is 0-2 repeatably. Could you please give me any hint? Thanks
微信图片_20190404095013.jpg
  4 件のコメント
Adam
Adam 2019 年 4 月 4 日
編集済み: Adam 2019 年 4 月 4 日
I would go for the multiple axes approach myself, though if they are right next to each other you will have problems with those x labels where you want both a '2' for the end of one and a '0' for the start of the other. I guess you can miss of the '2' labels (or equivalently the '0' labels') and use the XTickLabel property for the 0 of each axes to change it to '2/0' as you have in your picture if you wish.
dpb
dpb 2019 年 4 月 4 日
Yeah, the tick labels will have to be written manually to look like that...which will mean writing callback routines if want any of the dynamic stuff to work with changes in xlim, zoom, etc., ...
To do it to make one figure for presentation isn't too terrible but "to do it right" would be a lot of effort, unfortunately.

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

採用された回答

Kelly Kearney
Kelly Kearney 2019 年 4 月 4 日
I think the only slightly difficult part of this would be the modified x-ticks. When I create adjacent axes like this, I prefer to stagger the x axes tick locations between the top and bottom of the axes, like in the following example. Would that work for your case?
mar = 0.1; % margin around axes
nax = 4; % number of axes
xpos = linspace(mar, 1-mar, nax+1);
% Make the axes
for ii = 1:nax
ax(ii) = axes('position', [xpos(ii) mar (1-2*mar)./nax 1-2*mar]);
end
set(ax, 'xlim', [0 2], 'ylim', [0 15], 'ydir', 'reverse', 'box', 'off');
set(ax(2:end), 'ycolor', 'none');
% Stagger x-axes so xticks don't overlap
set(ax(2:2:end), 'xaxisloc', 'top');
% Add a box around all the axes, and dashed lines between them
an = annotation('rectangle', [mar mar 1-2*mar 1-2*mar]);
for ii = 1:3
annotation('line', [xpos(ii+1) xpos(ii+1)], [mar 1-mar], 'linestyle', '--');
end
axisexample.png
  1 件のコメント
dpb
dpb 2019 年 4 月 4 日
Nicely done for the position calc's; that's cleaner than any I'd ever sat down and coded...consider the snippet stolen! :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by