Restore Default Font Colors of Figures

20 次查看(过去 30 天)
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

采纳的回答

Steven Lord
Steven Lord 2023-5-8
See the "Remove Default Values" or "Set Properties to Factory-Defined Values" sections on this documentation page.
  3 个评论
Steven Lord
Steven Lord 2023-5-8
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 2023-5-8
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!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by