13
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

matlab figureのデフォルトをいい感じに修正する

Last updated at Posted at 2019-03-03

はじめに

研究のお供として優秀なMatlabですが、論文を想定するとfigureコマンドにて表示される図の見た目がイマイチ・・・そんなときの対策を自分用にまとめました。

何もしていない場合のfigure

t = [-100:100];
x = t .* t;
plot(t,x);

こうなります。
image.png

普通に使う分にはこれでOKと思うのですが、論文に張り付けようと思うと
・背景色がグレーなのがなんとなく嫌
・フォントがTimesでないのがなんとなく嫌
など、微妙なこだわりポイントが出てきます。
plotした後で設定してもよいのですが、面倒です。

デフォルト設定を修正する

こちらのサイトを参考に、下記の設定を行いました。

%figureの背景色
set(0,'defaultfigurecolor',[1 1 1]);

% 軸のフォント
set(0, 'defaultAxesFontName', 'Times');

% タイトル、注釈などのフォント
set(0, 'defaultTextFontName', 'Times');

フォントサイズ等はあとからいじれば良いかなと。
上記コマンドを入力後、plotを再度呼ぶと下記のようになります。
image.png

とりあえず満足。

追記 弊害および設定の戻し方

上記設定をした上で、ボード線図を作成したところ、
日本語表現の部分が文字化けして□□□になってしまいました。

image.png

設定を元に戻すには、下記のコマンドが必要です。
とりあえず'default'って打っておけばOKな感じです。

%figureの背景色
set(0,'defaultfigurecolor','default');

% 軸のフォント
set(0, 'defaultAxesFontName', 'default');

% タイトル、注釈などのフォント
set(0, 'defaultTextFontName', 'default');

image.png

13
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?