Legend shows just 8 from 9 entries

1 次查看(过去 30 天)
Nik Rocky
Nik Rocky 2020-6-20
编辑: Nik Rocky 2020-6-21
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!

回答(2 个)

madhan ravi
madhan ravi 2020-6-20
Highly probable that one of your plot handle is empty.
  2 个评论
Nik Rocky
Nik Rocky 2020-6-21
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!

请先登录,再进行评论。


Nik Rocky
Nik Rocky 2020-6-21
编辑:Nik Rocky 2020-6-21
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!

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by