Skip to content
This repository was archived by the owner on Apr 5, 2019. It is now read-only.

Upcoming MATLAB release supports autoupdating legend #15

Open
erikhuizinga opened this issue Dec 22, 2016 · 3 comments
Open

Upcoming MATLAB release supports autoupdating legend #15

erikhuizinga opened this issue Dec 22, 2016 · 3 comments
Labels

Comments

@erikhuizinga
Copy link

erikhuizinga commented Dec 22, 2016

MATLAB has released R2017a Prerelease to some users. In the release notes on page 1-3 under Graphics, it is mentioned the legend function now supports the following behaviour.

Create legends that update when data is added to or removed from the axes

This is partially what legtools is intended for, so legtools could be updated to remain compatible with this new functionality (e.g. make use of it?) while retaining support for older MATLAB versions.

@erikhuizinga erikhuizinga changed the title Upcoming MATLAB release contains updating legend Upcoming MATLAB release supports autoupdating legend Dec 22, 2016
@sco1
Copy link
Member

sco1 commented Dec 23, 2016

Thanks for the heads up, this was something I noticed as well going through the prerelease notes.

With AutoUpdate enabled:

  • legtools.append no longer works, MATLAB ignores the extra legend entry since it's added its own
  • legtools.permute no longer works
  • legtools.remove no longer works
  • legtools.adddummy still functions, but the internal legtools.append call has the same issue as above

Yay!

Simply toggling AutoUpdate doesn't work with the current implementation, the extra entries are removed/added once it's turned back on. There's still a little bit of time until R2017a is officially released so some options will be explored to hopefully resolve the issues.

@sco1 sco1 added the bug label Dec 23, 2016
@sco1
Copy link
Member

sco1 commented Jul 13, 2018

The recently published Undocumented MATLAB article may have yielded a more reliable approach to manipulating the legend entries to unbreak everything that was broken in R2017a.

hLegend.EntryContainer.NodeChildren seems to provide similar functionality to hLegend.PlotChildren, so there's a chance that legends in newer versions of MATLAB respect changes to this where it stopped respecting changes to PlotChildren.

I'll try to investigate over the weekend or early next week.

sco1 added a commit that referenced this issue Jul 13, 2018
The addition of 'AutoUpdate' to legend in R2017a breaks the
functionality of append. With 'AutoUpdate' turned off we can restore
the functionality of legtools, but turning it back on causes our
appended legend entries to be deleted. Clearing out the undocumented
'PlotChildrenExcluded' legend property seems to prevent this from
occuring

This is untested in versions < R2017a

See #15
@sco1
Copy link
Member

sco1 commented Jul 13, 2018

While the article doesn't seem to help like I was hoping it would, I did find an unrelated approach that seems to easily restore functionality to append and adddummy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants