legend doesn't appear on plot

1 次查看(过去 30 天)
talayeh ghodsi
talayeh ghodsi 2021-2-19
hi every body. I want to plot a simple problem with a legend. but the legend box is empty on plot as the image i have attached
could anybody help me please
p1_visual=[2 9 28 29 38 50]
p1_method=[3 8 26 31 40 51]
p2_visual=[3 10 26 28 28 51]
p2_method=[3 9 25 31 32 51]
X = categorical({'P1','P2'});
X = reordercats(X,{'P1','P2'});
y_visual_ED=([p1_visual(1);p2_visual(1)]);
y_method_ED=([p1_method(1);p2_method(1)]);
figure (1)
plot(X,y_visual_ED,'b--o',X,y_method_ED,'r-*')
ylim([0 60])
xlabel('Patient')
ylabel('Frame Number')
title('End Diastole')
legend('Visual reading','Proposed method')
figure(2)
y_visual_Ra.E=([p1_visual(2);p2_visual(2);p3_visual(2);p4_visual(2);p5_visual(2);P6_visual(2);p7_visual(2);P8_visual(2);P9_visual(2);p10_visual(2)]);
y_method_Ra.E=([p1_method(2);p2_method(2);P3_method(2);p4_method(2);p5_method(2);P6_method(2);p7_method(2);P8_method(2);P9_method(2);p10_method(2)]);
plot(X,y_visual_Ra.E,'b--o',X,y_method_Ra.E,'r-*')
ylim([0 60])
xlabel('Patient')
ylabel('Frame Number')
title('Rapid Ejection')
legend('Visual reading','Proposed method')
  3 个评论
talayeh ghodsi
talayeh ghodsi 2021-2-19
sorry but why inside the box in my plot is white and empty?
Walter Roberson
Walter Roberson 2021-2-19
Which MATLAB version are you using, and which operating system? What is the output of
opengl info
and what shows up for
which legend

请先登录,再进行评论。

回答(0 个)

类别

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