www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/ChangeLegendFontSizeAndColorExample.m
%% Modify Existing Legend % Plot a line chart and a stem chart. Add a legend to the axes and assign % the legend object to the variable |lgd|. Then, use |lgd| to modify % properties of the legend after it is created. x = linspace(-3,3,25); y1 = sin(x); plot(x,y1,'DisplayName','sin(x)') hold on y2 = cos(x); stem(x,y2,'DisplayName','cos(x)') hold off lgd = legend('show'); lgd.FontSize = 12; lgd.TextColor = 'blue';