フィルターのクリア

Increasing vertical spacing between subplots

195 ビュー (過去 30 日間)
Victor
Victor 2014 年 6 月 6 日
How do i increase the vertical spacing between subplots?

回答 (4 件)

Blake Johnson
Blake Johnson 2017 年 4 月 29 日
Here's a trick to add vertical space easily...
The title command lets you add a 2-line title, so if you use this command, it will create a blank line in the title, thus giving you extra space between the top and bottom plot.
title({'';'title of my plot'})
  1 件のコメント
Çağatay Murat Yılmaz
Çağatay Murat Yılmaz 2022 年 8 月 31 日
It worked, thanks.

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


Star Strider
Star Strider 2014 年 6 月 6 日
This is slightly complicated procedure, but not difficult if you have experience with handle graphics properties. It has been the subject of several recent posts here, so I’ll refer you to them:
How do I use suptitle in my subplot The Accepted Answer contributed by Cedric Wannaz is absolutely ingenious!
There are several other posts on this searching Answers with this query.
  1 件のコメント
hamza hamid
hamza hamid 2021 年 5 月 26 日
After all the last subplot write this code a=suptitle(‘The title of all figure’)% a is use to call the your title a.FontSize=10;% for change Fontsize

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


Heyang Qin
Heyang Qin 2018 年 7 月 31 日
You can add an extra empty line to your x label so that the vertical interval between subplots will increase.
For example,
xlabel("your xlabel"+newline+" ")
  2 件のコメント
LEONG SING YEW
LEONG SING YEW 2020 年 3 月 8 日
This trick is awesome, many thanks!!
Tim Darrah
Tim Darrah 2020 年 10 月 26 日
this doesnt work when
xtickangle(deg)
is used.
Why isn't there a simple function to add add vertical space of arbitrary length like there is in latex:
\vspace{.1in}
which adds a .1in space exactly where the command is called. MATLAB and latex seem to be tightly integrated, so not sure why this isn't done. A quick google search of this problem will reveal several "custom" answers and "hacks", but no generalizable solution that "just works".

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


dpb
dpb 2014 年 6 月 6 日
Shrink the height of the axes POSITION property and, if so desire, then readjust the bottom location to be equidistant if more than two for vertical; width if horizontal
  1 件のコメント
Joseph Cheng
Joseph Cheng 2014 年 6 月 6 日
編集済み: Joseph Cheng 2014 年 6 月 6 日
For an example of dpb's suggestion I answered a similar question here (where they wanted to decrease the spacing) http://www.mathworks.com/matlabcentral/answers/125319-how-to-plot-something-like-this
x=[60:20:260]; %set x axis ticks
y=rand(11); %get something to plot
h1=subplot(2,1,2); %setup subplot1
plot(x,y,'-.'); %plot subplot1
box on % leave only x and y axes
xlim([60 260]) %setup some x axis
set(h1,'Xtick',x) %set the x axis ticks to show only x
h1_pos = get(h1,'Position'); %get the position data for sublot1.
y2 = 10*y.^2; %make something up for subplot2
h2=subplot(2,1,1); %make subplot2
plot(x,10*y,'-.'); %plot subplot2
box on
set(h2,'Xcolor',[1 1 1]) %make the Y axis line white
set(h2,'Xtick',[])
xlim([60 260]) %setup some x axis
h2_pos=get(h2,'Position');
set(h2,'Position',[h1_pos(1) h1_pos(2)+.1+h1_pos(4) h2_pos(3:end)]) %using position of subplot1 put subplot2next to it.

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

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by