LoginSignup
8
9

More than 1 year has passed since last update.

【MATLAB】図の背景を透明化して保存する方法

Last updated at Posted at 2021-10-24

やりたいこと

MATLABで描画した図の背景を透明にして保存したい.

例えば、スライドの模式図に使えます.

本記事では、出力したFigureの背景を透明化してemf形式で保存する手法を紹介します。

explanation.png

記事の冒頭で紹介した画像の例です。この例では、波形だけを載せたい時を想定して、軸などの描画もなくしています。

main.m
x = 0:0.01:6*pi;

fig = figure(1);
ax = gca;
plot(x,sin(x),'LineWidth',4,'Color','black');

fig.Color = 'none';
ax.Color = 'none';
fig.InvertHardcopy = 'off';

% === (任意)軸,外枠の非表示 ===
ax.Box = 'off';
ax.XColor = 'none';
ax.YColor = 'none';
% ==============================

saveas(fig,'transparent.emf')

動作環境

MATLAB R2022a

8
9
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
8
9