Legend wont display lines properly in figure window

1 visualización (últimos 30 días)
Ethyn Smith
Ethyn Smith el 17 de Abr. de 2022
Comentada: VBBV el 17 de Abr. de 2022
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}))')

Respuestas (1)

VBBV
VBBV el 17 de Abr. de 2022
lgd = legend('Bundle','30% Opening','50% Opening', ...
'65% Opening','85% Opening','100% Opening');
Use without a { }
  2 comentarios
Ethyn Smith
Ethyn Smith el 17 de Abr. de 2022
Ive tried that but it just wont work. thank you anyway
VBBV
VBBV el 17 de Abr. de 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

Iniciar sesión para comentar.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by