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

AttributeError: 'Legend' object has no attribute '_ncol'. Did you mean: '_ncols'? #582

Open
aiodfy opened this issue Apr 24, 2023 · 2 comments

Comments

@aiodfy
Copy link

aiodfy commented Apr 24, 2023

When attempting to use Legends, the following error is presented.

AttributeError: 'Legend' object has no attribute '_ncol'. Did you mean: '_ncols'?

I quick search of the matplotlib docs showed that

The number of columns that the legend has.
For backward compatibility, the spelling ncol is also supported but it is discouraged. If both are given, ncols takes precedence

The Fix

_legends.py (Line 81)
Change
if obj._ncol != 1: data["current axes"].axis_options.append(f"legend columns={obj._ncol}")
to
if obj._ncols != 1: data["current axes"].axis_options.append(f"legend columns={obj._ncols}")

@FriedrichFroebel
Copy link

This duplicates (at least) #574, #565, #558 and #579 and just has not been merged yet.

Repository owner deleted a comment from st-- May 6, 2023
@M-G-King
Copy link

I had this same issue, and fixed it the same way

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

No branches or pull requests

3 participants