Skip to content
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
@sco1

Description

@sco1

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

Produces:
asdf

In this example we can see that the legend order should be [y1, y2, dummy] rather than the displayed [dummy, y1, y2].

See #7

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions