필터 지우기
필터 지우기

Save figure with black background and window

조회 수: 118 (최근 30일)
V.D-C
V.D-C 2020년 2월 24일
댓글: Lucian 2023년 12월 3일
Hello everybody,
I have several figures with black background, and I would like to save them and do something similar to the figure I link in this message (credits to A.Wherlé for the image).
How to get rid of the classic white or grey contour of the matlab window when I use save() ?
Thank you in advance and have a good day !
  댓글 수: 1
Adam
Adam 2020년 2월 24일
Does it not save the figure in the colour you give it?
e.g.
hFig = figure;
hFig.BackgroundColor = 'k';
and similar for axes if you want them black too.

댓글을 달려면 로그인하십시오.

채택된 답변

Samatha Aleti
Samatha Aleti 2020년 2월 27일
Hi,
According to my understanding you have MATLAB figure and want to change the background color of the figure and save(preserving the background). You can change the background color by setting the color using set” and save to required format using “saveas”. Here is a sample code:
f = figure;
surf(peaks);
set(gcf, 'InvertHardCopy', 'off');
set(gcf,'Color',[0 0 0]); % RGB values [0 0 0] indicates black color
saveas(gcf,'Peaks.png'); % save as .png file
  댓글 수: 2
V.D-C
V.D-C 2020년 2월 27일
This is perfect, thank you very much !
Lucian
Lucian 2023년 12월 3일
Thank you very much, also from my side

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by