tikzplotlib
tikzplotlib copied to clipboard
Problem to export tikz code with a legend
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.
This appears to be a duplicate of #557 and has an unmerged fix in #558.
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'