Reputation: 489
EDIT: Simplified example also exhibits the same behavior. Using MATLAB R2015b
This code used to work just fine, but is suddenly causing me problems. The legend uses the color attributed to the last object created.
Strangely, it uses the correct marker shape, but not the correct marker color. Any ideas of what's going on, or at the very least how to workaround?
Computation and plotting is fine, the only thing wrong is the legend uses the same color for both objects.
figure;
P1 = scatter(4, 6);
hold on;
P2 = scatter(2, 9);
set(P1, 'CData', [1 0 0]);
set(P2, 'CData', [0 0 1]);
set(P1, 'Marker', 's');
set(P2, 'Marker', '^');
hold off;
legend('P1', 'P2');
Upvotes: 1
Views: 232
Reputation: 489
Turns out to be a known bug in R2015b. It has been fixed in R2016a, and there is a patch on the bug report page.
Upvotes: 2