Skip to content

Commit 6b2c2ec

Browse files
author
Gorshanov Vadim
committed
Add fix for missing attribute _ncol
1 parent 450712b commit 6b2c2ec

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/tikzplotlib/_legend.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ def draw_legend(data, obj):
7878
if alignment:
7979
data["current axes"].axis_options.append(f"legend cell align={{{alignment}}}")
8080

81-
if obj._ncol != 1:
82-
data["current axes"].axis_options.append(f"legend columns={obj._ncol}")
81+
try:
82+
if obj._ncol != 1:
83+
data["current axes"].axis_options.append(f"legend columns={obj._ncol}")
84+
except AttributeError:
85+
warnings.warn("Unable to interrogate the number of columns in legend. Using 1 as default.")
8386

8487
# Write styles to data
8588
if legend_style:

0 commit comments

Comments
 (0)