필터 지우기
필터 지우기

legend color mismatch with actual plot

조회 수: 1 (최근 30일)
Drach
Drach 2019년 3월 22일
편집: Adam 2019년 3월 22일
Hi everyone,
I looked for similar problems but I couldn't quite wrap my head around the solutions, so I'm sorry of this problem was already solved.
I want to plot a number of vectors from a cell:
y_shift =
3×3 cell array
{5×1 double} {5×1 double} {5×1 double}
{5×1 double} {5×1 double} {5×1 double}
{5×1 double} {5×1 double} {5×1 double}
this is the code for plotting:
p = 2;
figure(p)
for q = 1:3
plot(x_shift{p,q},'LineWidth',2,'Marker','+')
plot(y_shift{p,q},'LineWidth',2,'Marker','+')
hold on
end
title('shifts in x and y for unit 2')
xlabel('dataset')
ylabel('shift in px')
legend_tot = ['geocam1'; 'geocam2'; 'textcam'];
legend(legend_tot)
xticks(x_vals_dummy)
grid on
hold off
The problem is that the colors of the legend don't match with my actual graph.
Is there an easy way to solve this?
Thanks alot!
  댓글 수: 1
Adam
Adam 2019년 3월 22일
편집: Adam 2019년 3월 22일
It would help if you showed the plot, though at a glance you appear to be running 6 plot instructions and only adding 3 elements to the legend. Although the location of your
hold on
instruction means I would imagine you only end up with 5 plots as the 2nd is plotted in place of the 1st before hold is set to on.

댓글을 달려면 로그인하십시오.

답변 (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