Axis ticks and colorbar labels in bold (heatmap)?

조회 수: 40 (최근 30일)
M.G.
M.G. 2020년 11월 19일
댓글: Tony Hu 2025년 1월 24일 9:13
I created a heatmap and I've got my axis labels in bold for better visibility. I had to use this '\bf\ thing to be able to do that, because, apparently, the normal way of:
h = heatmap(X, Y, C, 'FontName', 'Times New Roman', 'FontSize', 13, 'FontWeight', 'bold');
doesn't work with heatmaps.
Now, I'd like to have the axis ticks and the colorbar labels in bold as well. Is that a way to do so in matlab? I couldn't find a solution for that by myself.

채택된 답변

dpb
dpb 2020년 11월 20일
편집: dpb 2020년 11월 20일
Another case where TMW is too clever by far in creating an opaque graphics object -- you have to use the hidden properties to find the underlying pieces.
hAx=h.NodeChildren(3); % return the heatmap underlying axes handle
hAx.FontWeight='bold';
hCB=h.NodeChildren(2); % the wanted colorbar handle
hCB.FontWeight='bold';
You can further explore the handles in the NodeChildren array at your leisure.
And, add your voice to the complaints to TMW about their being hidden properties and this propensity to do such nasty things to their users causing them to waste precious billable hours on trivia. If I were still consulting actively, I'd raise holy cain with them. As is, I complain here every chance I get for what good it may do and have communicated my distaste for the policy directly.
  댓글 수: 4
dpb
dpb 2025년 1월 19일 12:53
편집: dpb 2025년 1월 19일 12:54
The best tool out there is <Yair Altman's getundoc>. It works here, unfortunately, even it can't get at the pieces of some of the more recent stuff that is truly opaque or that erases the underlying object if try to add/change anything even if can find the handle...
Tony Hu
Tony Hu 2025년 1월 24일 9:13
That's really a great function! I feel like discovering a new world just like Columbus

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by