This repository was archived by the owner on Apr 5, 2019. It is now read-only.
This repository was archived by the owner on Apr 5, 2019. It is now read-only.
Order issues when appending to permuted legends #11
Closed
Description
legtools.append
operates under the assumption that the order of the legend entries is always the same as the order of the plot objects in the parent axes. Because of this, if we permute the legend entries and then append/remove entries, the legend entries can become inconsistent with the plot entries.
For example:
% Set up figure
x = 1:10;
y1 = x;
y2 = x + 1;
figure
plot(x, y1, x, y2);
lh = legend('y1', 'y2');
legtools.adddummy(lh, 'dummy', 'ok')
legtools.permute(lh, [3 2 1])
legtools.remove(lh, 2)
legtools.append(lh, 'y2') % Now we're off the rails
In this example we can see that the legend order should be [y1, y2, dummy]
rather than the displayed [dummy, y1, y2]
.
See #7