multiple graphs without spacing

3 ビュー (過去 30 日間)
Gamolica
Gamolica 2023 年 6 月 21 日
コメント済み: Jan 2024 年 7 月 24 日
How can i do this? Without any spacing, one x label, one y label vs vs
thanks.

回答 (2 件)

Dyuman Joshi
Dyuman Joshi 2023 年 6 月 21 日
You can use tiledlayout with the spacing between the tiles set to zero.
Note that you will have to edit x-axes and y-axes properties (limits, ticks and tick-labels) accordingly.
x1 = [2.6795 3.46422 3.88829 4.00262 4.3035 4.54301];
y1 = [5.48 8.12e-4 1.2 27.9 6.59 5.17];
x2 = [2.054 2.08 2.091 2.099 2.103 2.112];
y2 = [0.125 0.14 0.118 0.099 0.257 0.082];
tiledlayout(2,1,'TileSpacing','none');
nexttile
plot(x1,y1)
%modify axis properties accordingly
xlim([2 4])
xticks(2:0.5:4)
%removing xtick labels as the labels will appear on the next tile
xticklabels([])
nexttile
plot(x2,y2)
%modifying axis properties to align with the previous tile
xlim([2 4])
xticks(2:0.5:4)
  1 件のコメント
Jan
Jan 2024 年 7 月 24 日
There are two values on the same place in the midle of y axis. How to figure it out?

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


Kanishk Singhal
Kanishk Singhal 2023 年 6 月 21 日
You can look at this documentation of stackedplot.
  2 件のコメント
Gamolica
Gamolica 2023 年 6 月 21 日
Thanks, but my x's are not the same. For example, in this photo, the left columns are for the below graph, and the right is for the above chart.
Kanishk Singhal
Kanishk Singhal 2023 年 6 月 23 日
You can specify the xlim for each plot separately so, what is the issue.
You can use barplot in a tiled layout manner too.

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

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by