Skip to content

re-ordered the list of artists returned by legend_handler.HandlerErrorbar #2532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

tacaswell
Copy link
Member

This is to address an issue raised on SO http://stackoverflow.com/questions/19470104/python-matplotlib-errobar-legend-picking.

As near as I can tell, create_artists is only ever called by HandlerBase.__call__() which then drops all but the first artist, which is returned by __call__ and added to legend.ledgendHandles.

Re-ordering the artist makes picking on them behave better (see the SO question at the top).

This technically breaks the API, but I would be surprised if anyone is actually using this (yes, http://xkcd.com/1172/).

@mdboom
Copy link
Member

mdboom commented Oct 21, 2013

Is there a way to write an easy test for this?

@tacaswell
Copy link
Member Author

It would be easy to test if the returned artist is a Line2D object or not, but I'm not sure if that is the right thing to test for.

I suspect that this band-aid which hides an underlying picking issue when dealing with over-lapping artists (which may be un-fixable).

I also suspect that is a down-payment on a more substantial re-work of Legend as returning just the first artists seems really hacky and Legend should really keep the full lists of the artists used to make each legend entry.

artists.extend(handle_barlinecols)
artists.extend(handle_caplines)
artists.append(legline)
artists.append(legline_marker)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this result in 2 newlines? (its hard to tell with github). If so, would you mind removing one of them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, I also pep8'd the entire file while I was at it.

@tacaswell
Copy link
Member Author

rebased onto current master.

@tacaswell
Copy link
Member Author

re-based again, my local master wasn't really pointing at upstream master, sorry about that.

@tacaswell tacaswell modified the milestones: v1.4.x, v1.4.0 Feb 27, 2014
@tacaswell tacaswell modified the milestones: v1.5.x, v1.4.x Nov 12, 2014
@tacaswell tacaswell modified the milestones: proposed next point release, next point release Feb 19, 2015
@tacaswell tacaswell force-pushed the errorbar_handler_artist_order branch from 6caa4ac to a256a2c Compare May 16, 2015 02:49
@tacaswell tacaswell force-pushed the errorbar_handler_artist_order branch from a256a2c to 6882780 Compare May 16, 2015 02:50
@tacaswell tacaswell modified the milestones: next point release, proposed next point release Jun 18, 2015
@tacaswell tacaswell closed this Sep 16, 2016
@tacaswell tacaswell reopened this Sep 16, 2016
@tacaswell
Copy link
Member Author

I am going to abandon this PR.

@tacaswell tacaswell closed this Aug 29, 2017
@tacaswell tacaswell deleted the errorbar_handler_artist_order branch August 29, 2017 01:35
@QuLogic QuLogic added this to the unassigned milestone Aug 29, 2017
@QuLogic QuLogic removed this from the 2.1 (next point release) milestone Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants