www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/SpecifyChartsToIncludeInLegendExample.m
%% Specify Charts to Include in Legend % Plot three lines and return the chart line objects created. Then, create % a legend that includes only two of the lines by specifying the first % input argument as a vector of the chart line objects to include. x = linspace(0,3*pi); y1 = sin(x); p1 = plot(x,y1); hold on y2 = sin(x - pi/4); p2 = plot(x,y2); y3 = sin(x - pi/2); p3 = plot(x,y3); hold off legend([p1 p3],'First','Third')