Legend shows just 8 from 9 entries

1 visualización (últimos 30 días)
Nik Rocky
Nik Rocky el 20 de Jun. de 2020
Editada: Nik Rocky el 21 de Jun. de 2020
Hello,
I want print legend:
Leg = ["Motor 1","Motor 2","Motor 3","Motor 4","Motor 1 harm","Motor 2 harm","Motor 3 harm","Motor 4 harm","Traj"];
legend([p1 p2 p3 p4 p6 p11 p12 p13 p14],Leg);
but i get just:
I tried allready to change a places and plot shows just 8 entries on the same time. What is wrong?
Thank you!

Respuestas (2)

madhan ravi
madhan ravi el 20 de Jun. de 2020
Highly probable that one of your plot handle is empty.
  2 comentarios
Nik Rocky
Nik Rocky el 21 de Jun. de 2020
No, I tried allready to change a places p_x1 an p_x2 and some names. Plot have stil just 8 entries and there are nonzero!
madhan ravi
madhan ravi el 21 de Jun. de 2020
Editada: madhan ravi el 21 de Jun. de 2020
Paste full code.

Iniciar sesión para comentar.


Nik Rocky
Nik Rocky el 21 de Jun. de 2020
Editada: Nik Rocky el 21 de Jun. de 2020
Here please, but now works! I rename also some plots.
figure('Name','Measured Data','NumberTitle','on');
hold on
myspec(x,Fs);
title("Result: " + file_name,'Interpreter','none')
hold on
p1 = plot(t_ref,m1,'-o','LineWidth',1.5,'Color','r');
hold on
p2 = plot(t_ref,m1*2,'-o','LineWidth',1.5,'Color','r');
hold on
p3 = plot(t_ref,m2,'-o','LineWidth',1.5,'Color','g');
hold on
p4 = plot(t_ref,m2,'-o','LineWidth',1.5,'Color','g');
hold on
p5 = plot(t_ref,m3,'-o','LineWidth',1.5,'Color','b');
hold on
p6 = plot(t_ref,m3,'-o','LineWidth',1.5,'Color','b');
hold on
p7 = plot(t_ref,m4,'-o','LineWidth',1.5,'Color','m');
hold on
p8 = plot(t_ref,m4,'-o','LineWidth',1.5,'Color','m');
colors = lines(length(Traj_interpl));
for u = 1:length(Traj_interpl)
hold on;
p9 = plot(Traj_interpl{u}(:,1),Traj_interpl{u}(:,2),'w--o','LineWidth',2,'MarkerFaceColor',colors(u,:));
end
for m_act = 2:30
hold on
set(gca, 'ColorOrder', [0.7 0.7 0.7])
p10 = plot(t,v1*m_act,t,v2*m_act,t,v3*m_act,t,v4*m_act);
end
ylim([0 500]);
xlabel('t_{seconds}')
ylabel('Rotation 1/s')
Leg = ["Motor 1","Motor 2","Motor 3","Motor 4","Motor 1 harm","Motor 2 harm","Motor 3 harm","Motor 4 harm","Traj"];
legend([p1 p2 p3 p4 p5 p6 p7 p8 p9],Leg);
saveas(gcf, [name, '.png'])
movefile([name, '.png'],FilePath)
The position of motors should be still changed, I have to change this, but - I think - its not a problem!

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by