Skip to content

Commit

Permalink
Legend Compatibility Issue in texworld#557 (#2) [copy of nschloe#558]
Browse files Browse the repository at this point in the history
* Legend Compatibility Issue in texworld#557

.

.

* Backwards Compat for `ncol`

Co-authored-by: st-- <st--@users.noreply.github.com>

---------

Co-authored-by: Paul Kim <44695374+thekpaul@users.noreply.github.com>
  • Loading branch information
st-- and thekpaul committed May 6, 2023
1 parent 450712b commit 02e872d
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 02e872d

Please sign in to comment.