I need to plot data of two vectors, and want the data points of each to be shown in a different colour that is explaned in a legend. However, the code below displays only the legend for the second one. What am I doing wrong?
for i_plot = 1 : plot_step : N subplot(N, 1, i_plot) h_A = plot(bookmarksA(i_plot, :),0,'b.','MarkerSize',24); legend('a'); xlim ([0 pieceDuration]) set(gca, 'yTick', []); title(subj_string(i_plot,:)) hold on h_Z = plot(bookmarksZ(i_plot, :),0,'r.','MarkerSize',24); legend(h_Z, 'z');end
Best Answer