How can default legend properties be set?

I am attempting to set default legend properties in a startup file, but I am having some difficulty. I'm using lines such as:
"set(0, 'DefaultAxesFontSize', 11, ...)"
to set the default font size for the axes as well as other axes properties. However, I cannot find anyway to set defaults for the legend like turning the box off or controlling the font properties independent from the rest of the figure text. Any help would be appreciated.
Thanks,
Andrew

回答 (2 件)

Sean de Wolski
Sean de Wolski 2013 年 7 月 16 日

0 投票

Typically I would recommend writing a wrapper function that does this then calling this function instead of legend:
function hLeg = AndrewLegend(varargin)
%Farm everything out to legend
hLeg = legend(varargin{:});
%Make changes:
set(hLeg,'Somefield',SomeValue);
%etc.
end
Abraham Gertler
Abraham Gertler 2021 年 6 月 3 日
編集済み: Abraham Gertler 2021 年 6 月 3 日

0 投票

set(groot, 'defaultLegendBox', 'off')
but i prefer the look of
set(groot, 'defaultLegendEdgeColor', 'none')
you can see all the modifiable properties of legend for example with
get(groot,'factoryLegend')
: )

カテゴリ

質問済み:

2013 年 7 月 16 日

編集済み:

2021 年 6 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by