tikzplotlib icon indicating copy to clipboard operation
tikzplotlib copied to clipboard

Problem to export tikz code with a legend

Open bilepeng opened this issue 2 years ago • 2 comments
trafficstars

Hi, Thanks for developing such a great tool! I experienced a bug today, which is easy to fix. In _legend.py, line 81 and 82, obj._ncol should be obj._ncols. Then the figure with a legend can be exported.

bilepeng avatar Jan 25 '23 14:01 bilepeng

This appears to be a duplicate of #557 and has an unmerged fix in #558.

FriedrichFroebel avatar Jan 25 '23 16:01 FriedrichFroebel

I encounter the same issue:

File ~/Python/lib/python3.11/site-packages/tikzplotlib/_legend.py:81, in draw_legend(data, obj)
     78 if alignment:
     79     data["current axes"].axis_options.append(f"legend cell align={{{alignment}}}")
---> 81 if obj._ncol != 1:
     82     data["current axes"].axis_options.append(f"legend columns={obj._ncol}")
     84 # Write styles to data

AttributeError: 'Legend' object has no attribute '_ncol'

2sn avatar Mar 02 '23 14:03 2sn