Problem when define Line Style and Linewidth
Show older comments
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 Comment
Star Strider
on 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).
Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!