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

Update _legend.py #581

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update _legend.py #581

wants to merge 1 commit into from

Conversation

youcann
Copy link

@youcann youcann commented Apr 18, 2023

Possible typo: _ncol instead of n_cols.
With _ncol calling tikzplotlib.save() on a plot containing legends results in the error:

Traceback (most recent call last):
  File "/home/marvin/phd_scripts/2023_04_14 picoscope/analyzepicoscope_class.py", line 36, in <module>
    tikzplotlib.save("picoscope.tikz")
  File "/home/marvin/.local/lib/python3.10/site-packages/tikzplotlib/_save.py", line 262, in save
    code = get_tikz_code(*args, filepath=filepath, **kwargs)
  File "/home/marvin/.local/lib/python3.10/site-packages/tikzplotlib/_save.py", line 213, in get_tikz_code
    data, content = _recurse(data, figure)
  File "/home/marvin/.local/lib/python3.10/site-packages/tikzplotlib/_save.py", line 352, in _recurse
    data, children_content = _recurse(data, child)
  File "/home/marvin/.local/lib/python3.10/site-packages/tikzplotlib/_save.py", line 380, in _recurse
    data = _legend.draw_legend(data, child)
  File "/home/marvin/.local/lib/python3.10/site-packages/tikzplotlib/_legend.py", line 81, in draw_legend
    if obj._ncol != 1:
AttributeError: 'Legend' object has no attribute '_ncol'. Did you mean: '_ncols'?

Possible typo: `_ncol` instead of `n_cols`.
With `_ncol` calling `tikzplotlib.save()` on a plot containing legends results in the error:
```
Traceback (most recent call last):
  File "/home/marvin/phd_scripts/2023_04_14 picoscope/analyzepicoscope_class.py", line 36, in <module>
    tikzplotlib.save("picoscope.tikz")
  File "/home/marvin/.local/lib/python3.10/site-packages/tikzplotlib/_save.py", line 262, in save
    code = get_tikz_code(*args, filepath=filepath, **kwargs)
  File "/home/marvin/.local/lib/python3.10/site-packages/tikzplotlib/_save.py", line 213, in get_tikz_code
    data, content = _recurse(data, figure)
  File "/home/marvin/.local/lib/python3.10/site-packages/tikzplotlib/_save.py", line 352, in _recurse
    data, children_content = _recurse(data, child)
  File "/home/marvin/.local/lib/python3.10/site-packages/tikzplotlib/_save.py", line 380, in _recurse
    data = _legend.draw_legend(data, child)
  File "/home/marvin/.local/lib/python3.10/site-packages/tikzplotlib/_legend.py", line 81, in draw_legend
    if obj._ncol != 1:
AttributeError: 'Legend' object has no attribute '_ncol'. Did you mean: '_ncols'?

```
@FriedrichFroebel
Copy link

This duplicates (at least) #574, #565, #558 and #579 and just has not been merged yet, see #574 (comment) as well. This is no typo, but a change from matplotlib 3.6.0.

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