How to globally set the default font for contour labels?
3 次查看(过去 30 天)
显示 更早的评论
I found out how to globally set defaults for Matlab's graphics fonts by setting, for example:
set(groot,'defaultTextFontName','Times New Roman')
so I changed the defaultTextFontName to, for instance, 'Times New Roman', yet when I plot a contour the labels still use Hellvetica (pun intended :)
As far as I understand (which is not that far), the labels belong to the 'Text' class, but using the 'defaultTextFontName' property has no effect:
set(groot,'defaultTextFontName','Times New Roman')
[x,y,z] = peaks;
[C,h] = contour(x,y,z);
clabel(C,h)
although setting it locally does work:
[x,y,z] = peaks;
[C,h] = contour(x,y,z);
clabel(C,h,'FontName','Times New Roman')
How can I globally change the contour label font?
0 个评论
回答(1 个)
Ishu
2024-2-6
Hi Phelype,
As "clabel" attributes are specific to contour plot only, and are produced after the contour plot is produced so according to me you will not be able to set these parameters globally. I have checked setting other defaults globally using "set" that are not specific to only contour plot and that is achieved without any error. Like you can gobally set "FontSize", "FontWeight" or "TextColor" that are not specific to only some plots:
set(0, 'DefaultTextFontSize', 10);
set(0, 'DefaultTextFontWeight', 'bold');
set(0, 'DefaultTextColor', 'blue');
set(0, 'DefaultLineMarkerSize', 30);
Below are MathWorks documentation that you can refer to:
contour plot - https://www.mathworks.com/help/matlab/ref/contour.html
Hope it helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!