필터 지우기
필터 지우기

Why doesn't heatmap use the default font?

조회 수: 4 (최근 30일)
O.Hubert
O.Hubert 2018년 8월 6일
댓글: Adam 2018년 8월 6일
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
Adam
Adam 2018년 8월 6일
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).

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by