Skip to content

Commit

Permalink
Fix from nschloe#558
Browse files Browse the repository at this point in the history
  • Loading branch information
pagmatt committed Feb 13, 2023
1 parent 450712b commit d0efbe2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/tikzplotlib/_legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,13 @@ def draw_legend(data, obj):
if alignment:
data["current axes"].axis_options.append(f"legend cell align={{{alignment}}}")

if obj._ncol != 1:
data["current axes"].axis_options.append(f"legend columns={obj._ncol}")
try:
ncols = obj._ncols
except AttributeError:
# backwards-compatibility with matplotlib < 3.6.0
ncols = obj._ncol
if ncols != 1:
data["current axes"].axis_options.append(f"legend columns={ncols}")

# Write styles to data
if legend_style:
Expand Down

0 comments on commit d0efbe2

Please sign in to comment.