Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

2.1 figure.legend broken #9320

Copy link
Copy link
Closed
Closed
Copy link
@2sn

Description

@2sn
Issue body actions

Bug report

figure.legend no longer accepts "handles" and and "labels" as keywords

Code for reproduction

# Paste your code here
#
#
fig.legend(
    handles = patches,
     labels = labels,
    ...)

**Actual outcome**

<!--The output produced by the above code, which may be a screenshot, console output, etc.-->

If applicable, paste the console output here

~/Python/lib/python3.6/site-packages/matplotlib/figure.py in legend(self, *args, **kwargs)
1523 '(artist handles, figure labels, legend location)')
1524
-> 1525 l = Legend(self, handles, labels, **kwargs)
1526 self.legends.append(l)
1527 l._remove_method = lambda h: self.legends.remove(h)
TypeError: init() got multiple values for argument 'handles'


**Expected outcome**

<!--A description of the expected outcome from the code snippet-->
<!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on-->

**Matplotlib version**
<!--Please specify your platform and versions of the relevant libraries you are using:-->
  * Operating system: Fedora 26
  * Matplotlib version: 2.1
  * Matplotlib backend (`print(matplotlib.get_backend())`): TkAgg
  * Python version: 3.6.3
  * Jupyter version (if applicable):
  * Other libraries: 

<!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda-->
<!--If you installed from conda, please specify which channel you used if not the default-->

**Fix**

if handles and labels are provided as kwargs, use these and pop from kwargs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.