Figure を print コマンドでファイル出力すると、Figure や Axes の背景色が設定されて​いるのに、白色で出力​されてしまうのはなぜ​ですか?

41 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2018 年 9 月 27 日
編集済み: MathWorks Support Team 2021 年 11 月 4 日
Figure や Axes の色を Color プロパティを使って、任意の色に設定しています。
しかし、print コマンドで JPG や PNG ファイルに出力すると、背景の色がすべて白になっています。
figure
plot(1:10)
set(gca, 'color', 'g') % 座標軸を緑 に設定
set(gcf, 'color', 'r') % Figure の背景を 赤に設定
print -djpeg myfig.jpg % 背景がすべて白になってしまう
 

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 11 月 4 日
編集済み: MathWorks Support Team 2021 年 11 月 4 日
これは、Figure オブジェクトの InvertHardCopy プロパティによるものです。デフォルトでは、ファイル出力したFigure の背景色は白になります。
・Figure : InvertHardCopy プロパティ
Figure の色を画面上の色とエクスポート後で一致させるには、Figure の InvertHardCopy プロパティを 'off' に設定します。
figure
plot(1:10)
set(gca, 'color', 'g')
set(gcf, 'color', 'r')
set(gcf, 'InvertHardCopy', 'off') % InvertHardCopy を off に設定する
print -djpeg myfig.jpg
関連するドキュメンテーションが下記よりご覧いただけます。
・背景色を保持した Figure の保存

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange印刷と保存 についてさらに検索

タグ

タグが未入力です。

製品

Community Treasure Hunt

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

Start Hunting!