This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

Specify Legend Descriptions During Line Creation

This example shows how to plot multiple lines and specify the associated legend labels during the plotting command.

Plot three sine curves. For each line, set the DisplayName property.

x = linspace(0,2*pi,100);
y1 = sin(x);
hold on

y2 = sin(x) + pi/2;
plot(x,y2,'DisplayName','sin(x) + \pi/2');

y3 = sin(x) + pi;
plot(x,y3,'DisplayName','sin(x) + \pi');
hold off

Create the legend. The legend uses the DisplayName property for the labels.


See Also

| |

Was this topic helpful?