どうすれば、R201​8aのバージョンでp​lotの軸の数字の大​きさを変更することが​できますか?

12 views (last 30 days)
masato koike
masato koike on 9 May 2018
Answered: michio on 9 May 2018
R2017aで行っていた軸の数字の大きさの変更がR2018aでできません。 以下に詳細を記します。
R2017aでは
figure
scatter(x,y)
ax = gca;
ax.FontSize = 13;
のようにすれば軸の数字の大きさを変更することができました。 しかし、R2018aではこれが実行できません。
同じコードを入力すると、 「クラス 'matlab.graphics.chart.primitive.Scatter' のプロパティ 'FontSize' が認識されません。」 とエラー表示が出てしまいます。
どうぞ、解決方法をご教示ください。
  2 Comments
mizuki
mizuki on 9 May 2018
上記のコードでは ; がないためエラーとなってしまいましたが、R2017a、R2018a ともに以下のコードで問題なく実行できています。(1行でも同様)
>> x = rand(1,5); y= rand(1,5);
>> figure;
>> scatter(x,y);
>> ax = gca;
>> ax.FontSize = 20;
確認したい点が2点あります。
他に実行されているコードや別途 scatter.m ファイルを作成してしまったということはありませんでしょうか。(以下のコマンドで複数あれば複数の結果が出てきます)
>> which -all scatter
また、ax の出力はどのような結果になっていますでしょうか。
michio
michio on 9 May 2018
コード部分の表示を編集いたしました。

Sign in to comment.

Answers (1)

michio
michio on 9 May 2018
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
scatter(x,y)
ax = gca;
ax.FontSize = 13;
を手元の R2018a で実行してみたところ、FontSize の変更は実行できました。特に R2017a/R2018a 間で FontSize プロパティ仕様に変更はありませんので、何が原因となっているのでしょうか。
例えば
ax = scatter(x,y)
ax.FontSize
と実行すると
クラス 'matlab.graphics.chart.primitive.Scatter' に対する適切なメソッド、プロパティ、またはフィールド 'FontSize' がありません。
との同様のエラーがでますので、scatterのオブジェクトの FontSize を変更する実行になってしまっているのではと推察しています。ご確認いただけますでしょうか。

Products

Community Treasure Hunt

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

Start Hunting!