필터 지우기
필터 지우기

Copying a figure with black background not working

조회 수: 3 (최근 30일)
Poulomi
Poulomi 2024년 7월 8일
댓글: Poulomi 2024년 7월 8일
I want to copy and paste my figure onto ppt.
I have made a figure using black background
This is what it looks like in open figure window:
However if I directly copy and paste it to ppt from the edit menu, it looks like this:
When I save it as jpg, this is what it looks like:
How to solve this issue?
Part of the code: (I am not sure if the way to make the background as black is the issue)
fig = figure;
fig.Color = 'k'; % figure background color black
tiledlayout(1, (num_days), 'TileSpacing', 'compact', 'Padding', 'compact');
% code to generate figure
ax = nexttile; % made it as I have to change the axis to white and background to black
% Set the axes background color to black
ax.Color = 'k'; % sets the axes color to black
% Adjust the colors for axes and grid to be more visible against the black background
ax.XColor = 'w'; % sets the x-axis line color to white
ax.YColor = 'w'; % sets the y-axis line color to white
ax.GridColor = 'w'; % sets the grid lines color to white (if visible grid is present)

채택된 답변

SAI SRUJAN
SAI SRUJAN 2024년 7월 8일
Hi Poulomi,
I understand that you are facing an issue with copying a figure with black background.
MATLAB's exportgraphics function provides more control over the export process. You can use it to save your figure while preserving the black background:
exportgraphics(fig, 'figure.png', 'BackgroundColor', "k");
For a comprehensive understanding of the 'exportgraphics' function in MATLAB, please refer to the following documentation.
I hope this helps!
  댓글 수: 1
Poulomi
Poulomi 2024년 7월 8일
So need to leverage this function....
Is there a way to directly use the copy figure in edit menu(solve there instead)?
I essentially dont want to save the figures.

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by