How to globally set the default font for contour labels?
4 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Ishu
on 6 Feb 2024
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 Comments
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!