8000 Change default value for the number of columns when generating a legend from qt_editor by Acanthostega · Pull Request #5713 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Change default value for the number of columns when generating a legend from qt_editor #5713

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

Merged
merged 1 commit into from
Dec 23, 2015

Conversation

Acanthostega
Copy link
Contributor

This is a correction related to the issue #5636 to make the legend generation working with more than two plots, due to the bad initialization of the number of columns. I hope without side effects...

…nd from the qt_editor, avoiding problems for large number of plots where no defaults are given for this value
@tacaswell tacaswell added this to the Critical bugfix release (1.5.1) milestone Dec 22, 2015
@tacaswell
Copy link
Member

This is a good enough solution here. It hard codes a 'magic' value, but is readable and works.

Most places in mpl None means 'do the default thing' and we have internal checks in the function to change None -> a usable default value (which usually involves a lookup in rcparams). However, in this case ncol is hard-coded to 1 in the signature of legend.

A some what less readable solution that hard-codes magic values in less places would be:

legend_kwargs = {}
if axes.legend_ is not None:
    old_legend = axes.get_legend()
    draggable = old_legend._draggable is not None
    legend_kwargs['ncol'] = old_legend._ncol
new_legend = axes.legend(**legend_kwargs)

tacaswell added a commit that referenced this pull request Dec 23, 2015
FIX: default column number in qt edit box

closes #5636
@tacaswell tacaswell merged commit d31ba4e into matplotlib:v1.5.x Dec 23, 2015
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.

2 participants
0