Why doesn't heatmap use the default font?

2 visualizaciones (últimos 30 días)
O.Hubert
O.Hubert el 6 de Ag. de 2018
Comentada: Adam el 6 de Ag. de 2018
Hello,
I would like to change the font in the axes of my heatmap. I provide a MWE below. I would like the Y-axis and the X-axis to be of the same font as the default and I don't want to manually change that for every plot as that would kill the idea of having a default fontname.
I am using MATLAB R2016a, so inserting 'FontName','Latin Modern Roman' in the heatmap function will not work.
Thank you in advance, Olivier.
% Minimum (Non)-Working Example
Country={'Belgium','France','Germany'};
random_matrix=rand(3,3);
% Set default depending on your MATLAB version
set(0, 'DefaultAxesFontName', 'Latin Modern Roman');
set(0, 'defaultAxesFontName', 'Latin Modern Roman');
% Generate the heatmap
figure('Name','Distance Matrix');heatmap(random_matrix, Country, Country, [], ...
'TickAngle', 45,'ShowAllTicks', true,'Colormap', 'gray','Colorbar', true,'ColorLevels',50);
title(['Distance Matrix']); % title is changed according to new default, but not the rest of the heatmap
% Option suggested in https://nl.mathworks.com/matlabcentral/answers/221149-is-it-not-possible-to-change-every-font-size-on-plots-at-the-same-time
fig = gcf;
set( findall(fig, 'property', 'FontName'), 'FontName', 'Latin Modern Roman') % Not working
  1 comentario
Adam
Adam el 6 de Ag. de 2018
h = heatmap( ... );
h.FontName = '...';
seems to work for me, although it seems to do some odd things to the font colour too in some cases (e.g. setting to Courier).

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Productos


Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by