Legend wont display lines properly in figure window
1 view (last 30 days)
Show older comments
Hi im hoping someone can help please. Im using the following code to plot a graph with multiple data sets and include a legend however when opening in the figure window the legend displays as below and i cannot figure out how to solve it. it displays fine in the live editor but in wont in the figure window. thanks in advance :)
figure
plot(Time_Bundle1,y1,'r--',time_2,y2,'b--',time_3,y3,'k--', ...
time_4,y4,'m--',time_5,y5,'g--',time_6,y6,'c--')
lgd = legend({'Bundle','30% Opening','50% Opening', ...
'65% Opening','85% Opening','100% Opening'});
title(lgd,'Experiment','FontSize',10)
grid on
grid minor
title('Processed Results using logarithmic deterioration')
% xlim([0 250])
ylim([-7 0.5])
xlabel('Time (s)')
ylabel('log((T - T_{a})/(T_{m} - T_{a}))')
0 Comments
Answers (1)
VBBV
on 17 Apr 2022
lgd = legend('Bundle','30% Opening','50% Opening', ...
'65% Opening','85% Opening','100% Opening');
Use without a { }
2 Comments
VBBV
on 17 Apr 2022
ax = plot(Time_Bundle1,y1,'r--',time_2,y2,'b--',time_3,y3,'k--', ...
time_4,y4,'m--',time_5,y5,'g--',time_6,y6,'c--')
lgd = legend(ax,{'Bundle','30% Opening','50% Opening', ...
'65% Opening','85% Opening','100% Opening'});
Check using a function handle to plot function
See Also
Categories
Find more on Legend 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!