Is there an option to change the symbol size in the legend that Matlab creates? I only want to increase the symbol size in the legend. I have used 4 scatters of 3 points each.
The organization of the elements in the legend is now different. The following works:
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
To increase font size: get handles to all legend's children of type 'text'
, and set their 'Fontsize'
property to the desired value.
To increase marker size: get handles to all legend's children of type 'line'
, and set their 'Markersize'
property to the desired value.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With