how to create one plot with several contours (corner plot)

I have contours created by several matrices.
I need to arrange them in that manner:
How can I do so? (of course I already have the matrices and each contour seperatley )

2 件のコメント

KSSV
KSSV 2022 年 4 月 8 日
REad about subplot, tiledlayout.
Tal Shavit
Tal Shavit 2022 年 4 月 8 日
Thank you!

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

回答 (1 件)

Adam Danz
Adam Danz 2022 年 4 月 8 日

0 投票

As KSSV recommended, tiledlayout is the way to go.
tcl = tiledlayout(3,3,'TileSpacing','none');
tileIdx = [1,4,5,7,8,9]; % row-wise index of tiles
ax = gobjects(size(tileIdx));
for i = 1:numel(tileIdx)
ax(i) = nexttile(tcl,tileIdx(i));
contour(ax(i), magic(8))
end
% equate axis ranges and turn off tick labels for inner axes
linkaxes(ax)
set(ax(3),'YTickLabel',[],'XTickLabel',[])
set(ax(5:6),'YTickLabel',[])

7 件のコメント

Tal Shavit
Tal Shavit 2022 年 4 月 8 日
I don't really get at what stage do i give it my matrices to contour :D
but that seems like what I need,
can you please elaborate?
thank you so much.
Adam Danz
Adam Danz 2022 年 4 月 8 日
You'll plot the contours within the for-loop (copied below)
I just used filler data in my demo.
for i = 1:numel(tileIdx)
ax(i) = nexttile(tcl,tileIdx(i));
contour(ax(i), magic(8)) % <----- here
end
Tal Shavit
Tal Shavit 2022 年 4 月 8 日
wow it worked, thank you so much.
but if I have different Y axes, how can I seperate them:
Adam Danz
Adam Danz 2022 年 4 月 8 日
What does it mean to separate them? Separate the tiles? See the TileSpacing property.
Tal Shavit
Tal Shavit 2022 年 4 月 8 日
I've managed to do the following: (as you have said)
but , as you can see , they have the same axes (I've sorted them that way).
I would like them to share the axes
is it possible?
Adam Danz
Adam Danz 2022 年 4 月 8 日
It looks like you didn't include the lines at the bottom of my answer using linkaxes and the two set commands.
linkaxes will link all of the axes limits and tick. The two set commands will eliminate the axis tick labels in the inner tiles.
Tal Shavit
Tal Shavit 2022 年 4 月 9 日
amazing!
I still didn't figure which numbers to exactly give, but im playing with that
thank you so much' you have helped me alot

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

カテゴリ

ヘルプ センター および File ExchangeContour Plots についてさらに検索

製品

タグ

質問済み:

2022 年 4 月 8 日

コメント済み:

2022 年 4 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by