Tiledlayoutの共有軸ラベルの位置について
    17 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
Tiledlayoutで複数のグラフを作成し、各グラフの下側に各々のグラフのキャプションをつけています。最下列のグラフのキャプションとX軸に関する共有軸ラベルが重ならないように共有軸ラベルの位置を下げたいのですが方法ありますか。
0 commentaires
Réponses (3)
  Atsushi Ueno
      
 le 27 Juin 2023
        
      Modifié(e) : Atsushi Ueno
      
 le 27 Juin 2023
  
      状況を再現しました。tiledlayout の共有軸ラベル(Text objct)には 'Position' プロパティが存在せず、値を変更する事が出来ません。苦肉の策として、xlabel関数に複数行を表示させる機能があるので、2行表示させて1行目を空の文字列にするというのはどうでしょうか?
t = tiledlayout(2,2);
nexttile; plot(rand(1,20)); title('Long long Caption 1','Position',[10 -0.3 0]);
nexttile; plot(rand(1,20)); title('Long long Caption 2','Position',[10 -0.3 0]);
nexttile; plot(rand(1,20)); title('Long long Caption 3','Position',[10 -0.3 0]);
nexttile; plot(rand(1,20)); title('Long long Caption 4','Position',[10 -0.3 0]);
htx = xlabel(t,{'ぶつかってしまう!','Shared X Axis Label 2行目ならぶつからない!'});
tiledlayout の共有軸ラベル(Text objct)は隠しプロパティになっているようです。VerticalAlignmentというプロパティはありますが、Positionプロパティは見つかりませんでした。なぜでしょう?
mt = metaclass(htx); % 共有軸ラベルのTextオブジェクトに'Position'プロパティが無い
b = [{mt.PropertyList.Hidden}' {mt.PropertyList.Name}']
0 commentaires
  Hiroshi Iwamura
      
 le 27 Juin 2023
        Ueno さんが再現スクリプトを作ってくださっていますが、このように実際に試せるスクリプトを載せていただくと回答が付きやすいかと思います。
R2021a 以降であれば、空 legend を使う手もありますかね。
通常の各グラフの legend とも併用可能です。 
t = tiledlayout(2,2);
nexttile; plot(rand(1,20)); title('Long long Caption 1','Position',[10 -0.3 0]);
nexttile; plot(rand(1,20)); title('Long long Caption 2','Position',[10 -0.3 0]);
nexttile; plot(rand(1,20)); title('Long long Caption 3','Position',[10 -0.3 0]);
nexttile; plot(rand(1,20)); title('Long long Caption 4','Position',[10 -0.3 0]);
% ここに空 legend を表示させて隙間を空ける
htx = xlabel(t,{'↑ Can you see this empty legend?'});
sg = sgtitle('Subplot Grid Title'); % なくても良い
% 空 legend
le = legend('');
le.Box = 'off';
le.Layout.Tile = 5;
le.FontSize = 7.2; % これで間隔調整可
le.Layout.Tile = "south";
0 commentaires
  交感神経優位なあかべぇ
      
 le 28 Juin 2023
        各グラフの下側に各々のグラフのキャプションのつけ方ですが、xlabelを使用してキャプションをつければ重ならないことに気づきました。
t = tiledlayout(2,2);
nexttile; plot(rand(1,20)); xlabel('Long long Caption 1');
nexttile; plot(rand(1,20)); xlabel('Long long Caption 2');
nexttile; plot(rand(1,20)); xlabel('Long long Caption 3');
nexttile; plot(rand(1,20)); xlabel('Long long Caption 4');
htx = xlabel(t,'ぶつかってしまわない!');
0 commentaires
Voir également
Catégories
				En savoir plus sur 座標軸の外観 dans Help Center et File Exchange
			
	Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

