From c8def911f821ab57c9f05a53367a0bdc636023ee Mon Sep 17 00:00:00 2001
From: Kefal <sam118142@gmail.com>
Date: Sun, 29 Oct 2023 17:33:27 +0300
Subject: [PATCH] fix subplots

---
 graph_widget/graph.py | 39 ++++++++-------------------------------
 1 file changed, 8 insertions(+), 31 deletions(-)

diff --git a/graph_widget/graph.py b/graph_widget/graph.py
index f81dccc..f527ebf 100644
--- a/graph_widget/graph.py
+++ b/graph_widget/graph.py
@@ -13,33 +13,8 @@ class Graph:
         self.__chb = mult_subplots
         self.__ax = self.__fig.add_subplot()
 
-        # сделать отслеживание за состояние кнопок потом
-        """
-        if self.__chb==0:
-            if len(self.__x)>1:
-                for i in range(len(self.__x)):
-                    n=int(f"{len(self.__x)}1{i+1}")
-                
-                    axes=self.__fig.add_subplot(n)
-                    axes.set_title(f"График №{i+1}")
-                    c=axes.plot(self.__x[i],self.__y[i],label=lab)
-            else:
-                line=self.__ax.plot(self.__x[0],self.__y[0],label=lab,)
-                print(self.__x)
-
-        else:
-            if len(self.__x)>1: #много графиков на одном холсте
-                for i in range(len(self.__x)):
-                    self.__ax.plot(self.__x[i],self.__y[i])
-                    
-            
-            else:
-
-                line=self.__ax.plot(self.__x[0],self.__y[0],label=lab,)
-                print(self.__x)
-        """
         self.draw_n_func_plot()
-        self.draw_one_func()
+        
         self.draw_subplots()
 
         self.__ax.set_xlabel(xl)
@@ -65,12 +40,11 @@ class Graph:
         if self.__chb == 0 and len(self.__x) > 1:
             for i in range(len(self.__x)):
                 self.__ax.plot(self.__x[i], self.__y[i], label=self.labels[i])
+                #новое(старое) условие против проскока
+        if self.__chb == 0 and len(self.__x) == 1:
+            self.__ax.plot(self.__x[0], self.__y[0], label=self.labels[0]) 
 
-    def draw_one_func(
-        self,
-    ):
-        if len(self.__x) == 1:
-            self.__ax.plot(self.__x[0], self.__y[0], label=self.labels[0])  #
+    
 
     def draw_subplots(
         self,
@@ -82,6 +56,9 @@ class Graph:
                 axes = self.__fig.add_subplot(n)
                 axes.set_title(f"График №{i+1}")
                 axes.plot(self.__x[i], self.__y[i], label=self.labels[i])
+                        #новое(старое) условие против проскока
+        if self.__chb ==1  and len(self.__x) == 1:
+            self.__ax.plot(self.__x[0], self.__y[0], label=self.labels[0])
 
     @property
     def figure(