Problem when define Line Style and Linewidth

I am using the below code to plot 3 lines and when I define the Line Style and Linewidth, the text in the legend disappears. I tried rescaling the figure by using 'Position' and make it bigger but this didn'r solve the problem. Do you know how can I fix this? I am using the 2017b version.
t = linspace(0,5,100);
x = t.^2;
y = t.^3;
z = t.^4;
figure;
plot(t,x,'Linewidth',1)
hold on
plot(t,y,'--','Linewidth',1)
plot(t,z,':','Linewidth',1)
legend({'x','y','z'},'Location','Northwest')

1 commentaire

Star Strider
Star Strider le 19 Mar 2018
With the code you posted, I cannot reproduce the problem you describe. Your code runs correctly for me, and the legend box, text, and correct line types and color designations appear (in R2017b).

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by