Azzera filtri
Azzera filtri

Restore Default Font Colors of Figures

22 visualizzazioni (ultimi 30 giorni)
Hi All,
I did something that was rather unfortunate when scouring code in mathworks, while trying to understand what some code did, I was typing it into my command line a while ago. In the process it changed my default coloring of the background of my figure (which I promptly fixed), and global text color in matlab.
This is a current example of the figure is the png attachment 'Alexa_t_AllCells.png'. and the 'XandYColorChange.png' is an example of what I am looking for on a global scale. My code for making the figure is rather simple: see below.
figure
heatmap(log10(T_Alexaheat), table2cell(U_3), table2cell(U_3), ...
'%0.2f', 'TickAngle', 45, 'Colormap', redblue(30), ...
'Colorbar', true)
title('Log 10 Relationships of Median T_{1/2} Alexa Note: (x/y)')
%% this is for the second picture %%
ax = gca;
ax.XColor = 'k';
ax.YColor = 'k';
I figured a simple
set(groot, 'defaultFontColor' or 'defaultTextColor', 'k')
or
reset(gcf)
would get me to what I need, but that doesn't work. The second picture is not correct either, as I need the color bar and title to be readable, and I do not want to have to repeat the same code for every figure I create from hereon.
How does one fix this? (note that groot, defaultTextColor, 'k' will only cause the title to become black, not the axes nor the color bar follow suite)
Thanks,
Nick

Risposta accettata

Steven Lord
Steven Lord il 8 Mag 2023
See the "Remove Default Values" or "Set Properties to Factory-Defined Values" sections on this documentation page.
  3 Commenti
Steven Lord
Steven Lord il 8 Mag 2023
The simplest way to reset the figure properties is to restart MATLAB, especially if you've changed a lot of property default values (which it sounds like you have.)
If that's not an option, try scrolling back in the Command History looking for set calls.
If that too isn't an option, you should probably look for default axes properties set on either groot or the current figure.
get(groot, 'defaultaxes')
ans = struct with no fields.
get(gcf, 'defaultaxes')
ans = []
Nicholas Scott
Nicholas Scott il 8 Mag 2023
excellent. Thank you! I wasn't aware that restarting matlab restored factory settings! Thank goodness. I rarely restart matlab, so I didn't know that was a quick fix! That worked! Thanks!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by