Applied formatter

This commit is contained in:
Dmitriy Shishkov 2023-10-18 22:10:32 +03:00
parent 6887247d8d
commit e963806464
Signed by: dm1sh
GPG Key ID: 027994B0AA357688
2 changed files with 53 additions and 38 deletions

View File

@ -2,7 +2,9 @@ from matplotlib.figure import Figure
class Graph:
def __init__(self,x, y,labels,mult_subplots=0,xl="x",yl="y",linetype='k',lims=False):
def __init__(
self, x, y, labels, mult_subplots=0, xl="x", yl="y", linetype="k", lims=False
):
# словарь из настроек?
self.labels = labels
self.__x = x
@ -49,20 +51,30 @@ class Graph:
ax.axvline(x, ymin, ymax)
# принимаем плот и на нем же рисуем
def add_hline(ax,y=0, xmin=0, xmax=1,):
def add_hline(
ax,
y=0,
xmin=0,
xmax=1,
):
ax.axhline(y, xmin, xmax)
def draw_n_func_plot(self,): #много графиков на одном холсте
def draw_n_func_plot(
self,
): # много графиков на одном холсте
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])
def draw_one_func(self,):
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,):
def draw_subplots(
self,
):
if self.__chb == 1 and len(self.__x) > 1:
for i in range(len(self.__x)):
n = int(f"{len(self.__x)}1{i+1}")
@ -72,5 +84,7 @@ class Graph:
axes.plot(self.__x[i], self.__y[i], label=self.labels[i])
@property
def figure(self,):
def figure(
self,
):
return self.__fig

View File

@ -1,9 +1,10 @@
import matplotlib
matplotlib.use('Qt5Agg')
import Graph
import matplotlib
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from PyQt5 import QtWidgets
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT as NavigationToolbar
matplotlib.use("Qt5Agg")
class GraphWidget(QtWidgets.QWidget):