From 21b98a5f5971fc181d28fa2835cc95e5ed7bb682 Mon Sep 17 00:00:00 2001
From: eqnmapper <83826245+eqnmapper@users.noreply.github.com>
Date: Mon, 2 Jan 2023 23:51:03 +0100
Subject: [PATCH] Changed object.ncol to object.ncols

Since matplotlib=3.6 matplotlib.legend attribute was renamed from ncol to ncols. Renaming in the _legend.py file solves this error.
---
 src/tikzplotlib/_legend.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tikzplotlib/_legend.py b/src/tikzplotlib/_legend.py
index 29d8e635..bfe8683a 100644
--- a/src/tikzplotlib/_legend.py
+++ b/src/tikzplotlib/_legend.py
@@ -78,8 +78,8 @@ 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}")
+    if obj._ncols != 1:
+        data["current axes"].axis_options.append(f"legend columns={obj._ncols}")
 
     # Write styles to data
     if legend_style: