
yyaxis で描画した Y 軸の太さを調整することはできますか?
13 views (last 30 days)
Show older comments
MathWorks Support Team
on 21 Jun 2018
Edited: MathWorks Support Team
on 28 Jun 2018
yyaxis 関数で両側に Y 軸のあるグラフを作成しています。
Y 軸の太さを調整したいのですが、Axes の LineWidth プロパティを変更すると、上下の枠の太さも変更されてしまいます。
%%サンプルデータ定義
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
%%YYAXIS による描画
figure(1)
% 左側の軸に対する描画
yyaxis left
plot(x,y1)
xlabel('Time (\musec)');
ylabel('Slow Decay'); % Y 軸ラベル
% 軸の編集
ha1 = gca;
ha1.LineWidth = 2; % Axes の枠全体が調整される

Accepted Answer
MathWorks Support Team
on 28 Jun 2018
Axes の LineWidth プロパティでは、Axes 全体のラインの太さが調整されますが、Axes の YAxis プロパティから両軸の NumericRuler オブジェクトを取得し、このオブジェクトの LineWidth プロパティを編集することで、両 Y 軸の太さのみを変更することが可能です。
%%サンプルデータ定義
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
%%YYAXIS による描画
figure(1)
% 左側の軸に対する描画
yyaxis left
plot(x,y1)
xlabel('Time (\musec)');
ylabel('Slow Decay'); % Y 軸ラベル
% 軸の編集
ha1 = gca;
h_yaxis = ha1.YAxis; % 左右 Y 軸のNumericRuler オブジェクトを取得(サイズ [2x1])
h_yaxis(1).LineWidth = 2; % 左側の Y 軸の太さを変更

0 Comments
More Answers (0)
See Also
Categories
Find more on Two y-axis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!