Output figure as white background in dark mode [2023b beta]

428 Ansichten (letzte 30 Tage)
Hoang-Long
Hoang-Long am 12 Okt. 2023
Bearbeitet: Christian am 22 Sep. 2025 um 13:18
Dear all,
I appreciate for dark mode in 2023b version. However, for the output figure, my output figure works also based on dark mode which means black background and white text color. I take effort to change into "white mode" figure (white background, black text color). I used below code but it just work for one-by-one figure.
set(gca, 'Color','w', 'XColor','k', 'YColor','k')
set(gcf, 'Color','w')
set(gca,XScale='log');
colorPropObjs = findobj(gcf, "-property", "Color");
colorPropObjs(2).Color = [1.0000 1.0000 1.0000];
set(0,'defaultfigurecolor',[1 1 1]);
I would like to ask there are any ways to work on dark mode but the output figure as normal as white mode. or we can set up output figure at one time.
Thank you for your time,
Best regards,

Akzeptierte Antwort

Adam Danz
Adam Danz am 12 Okt. 2023
Bearbeitet: Adam Danz am 22 Apr. 2024
Hello @Hoang-Long, great question.
To be clear, Hoang-Long is using the R2023b beta version of the new desktop for MATLAB which can be downloaded from the file exchange (link). The themes features and behaviors described in the question and this answer are only relevant for the beta version in R2023b.
Setting the theme for an existing figure in R2023b Beta desktop
Set the Theme property of the figure (fig) to light or dark
fig.Theme = "dark";
% or
fig.Theme = "light";
Setting the default theme for existing and future figures in R2023b Beta desktop
s = settings;
s.matlab.appearance.figure.GraphicsTheme.TemporaryValue = "light";
% or
s.matlab.appearance.figure.GraphicsTheme.TemporaryValue = "dark";
This setting will persist until it's cleared, changed, or until MATLAB shuts down. This setting will not persist between MATLAB sessions. To clear the TemporaryValue,
clearTemporaryValue(s.matlab.appearance.figure.GraphicsTheme)
We are interested in hearing about your experience with themes and any issues or questions you run into.
  6 Kommentare
Adam Danz
Adam Danz am 22 Apr. 2024
Hi @Jack, I downloaded and installed the 24a release with the beta desktop and could not reproduce what you're describing. Here are the steps I took. Please let me know if you see anything unexpected when following these steps or provide a different set of steps that I can follow to produce the problem.
  1. My desktop is set to dark theme.
  2. I ran s = settings; s.matlab.appearance.figure.GraphicsTheme.TemporaryValue = "light";
  3. I called plot(magic(5))
The figure appeared as light as expected.
The "hit-or-miss" part of your description makes me suspicious that this is happening on figures with manually set colors. For example, if the axes color is manually set to some dark color, then switching the default figure theme to light will not affect the color of the axes.
Jack
Jack am 26 Apr. 2024
Hi @Adam Danz, I did as you said and got the same result of the light figure. However, I don't think i've manually set any axes colors for any of the affected plots. Like I said, it's intermittently happening for me, so I'll let you know if I run to this issue again in the future.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Alexander
Alexander am 26 Jun. 2024
Bearbeitet: Alexander am 26 Jun. 2024
pretty old questions but it was on top of google searches so this is what i did:
in matlab:
home -> preferences -> search for figure theme -> set it from auto to light
i hope this helps
  1 Kommentar
Christian
Christian am 22 Sep. 2025 um 13:18
Bearbeitet: Christian am 22 Sep. 2025 um 13:18
for 2023a/b revision that option is not available in the conf menu... thank you any way!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by