Matlab R2014a或更早版本
要增加字体大小:获取“text”类型的所有图例子项的句柄,并将其“Fontsize”属性设置为所需的值.
要增加标记大小:获取“line”类型的所有图例子项的句柄,并将其“Markersize”属性设置为所需的值.
plot(1:10, 'o-');
hold on
plot(5:12, 'r*--'); %// example plots
h = legend('one plot', 'another plot', 'location', 'NorthWest'); %// example legend
ch = findobj(get(h,'children'), 'type', 'text'); %// children of legend of type text
set(ch, 'Fontsize', 14); %// set value as desired
ch = findobj(get(h,'children'), 'type', 'line'); %// children of legend of type line
set(ch, 'Markersize', 12); %// set value as desired
Matlab R2014b或更新版(HG2)
图例中元素的组织现在是不同的.以下作品:
plot(1:10, 'o-');
hold on
plot(5:12, 'r*--'); %// example plots
[~, objh] = legend({'one plot', 'another plot'}, 'location', 'NorthWest', 'Fontsize', 14);
%// set font size as desired
objhl = findobj(objh, 'type', 'line'); %// objects of legend of type line
set(objhl, 'Markersize', 12); %// set marker size as desired