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

Legend marker label placement #3499

Merged

Conversation

cimarronm
Copy link
Contributor

Controls horizontal marker placement so that one specify either maker first or label first in the legend. This incorporates the feature request in issue #3285.

@mdboom
Copy link
Member

mdboom commented Sep 11, 2014

Cool!

I wonder if it would make more sense to right align everything -- this is just an aesthetic issue, so take it with a grain of salt.

Instead of (where xxx is text and XXX is markers):

xxx XXX
xxx XXX
xxxxxxx XXX

do:

    xxx XXX
    xxx XXX
xxxxxxx XXX

Then the markers are more pleasantly aligned.

@cimarronm
Copy link
Contributor Author

@mdboom, that definitely makes sense. I'll look into modifying to right align it when markers are on the right

align="baseline",
children=itemBoxes))
sep=self.labelspacing * fontsize,
align="baseline" if markerfirst else "right",
Copy link
Member

Choose a reason for hiding this comment

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

I am not a fan of the in-line logic, but not enough to make more fuss than leaving a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I'm not either but was being lazy. I'll rework it to remove it ternary if

@tacaswell
Copy link
Member

Can you re-base this to erase the old test images from history?

@cimarronm
Copy link
Contributor Author

Yeah, I'll remove the old image

@tacaswell
Copy link
Member

@cimarronm Could you re-run boilerplate.py to update pyplot with the new kwargs?

@tacaswell
Copy link
Member

This should also get a whats_new entry to advertise the new feature.

@cimarronm
Copy link
Contributor Author

boilerplate.py seems to be updating quite a bit of things. Seems like it may be doing something wrong for me. I'll try to look at it in more detail tonight.

@tacaswell
Copy link
Member

It may be the case that boilerplate has not been run in a while...

@WeatherGod
Copy link
Member

Also remember that boilerplate.py runs off of the installed version of
matplotlib, not the source tree, IIRC.

Ben Root

On Sat, Oct 18, 2014 at 1:44 PM, Thomas A Caswell notifications@github.com
wrote:

It may be the case that boilerplate has not been run in a while...


Reply to this email directly or view it on GitHub
#3499 (comment)
.

@cimarronm
Copy link
Contributor Author

@tacaswell Rebased on top of latest master and ran boilerplate.py. It doesn't look like any changes are needed to pyplot.py as legend is completely declared as a *args,**kwargs vardiac:

def legend(*args, **kwargs):
    ret = gca().legend(*args, **kwargs)
    draw_if_interactive()
    return ret

@cimarronm cimarronm force-pushed the legend_marker_label_placement branch from 66850c6 to d7210ff Compare November 6, 2014 05:51
tacaswell added a commit that referenced this pull request Nov 6, 2014
ENH : Legend marker label placement control
@tacaswell tacaswell merged commit 2b2016a into matplotlib:master Nov 6, 2014
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.

None yet

5 participants