Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib
- import numpy as np
- import matplotlib.pyplot as plt
- import matplotlib.backends.backend_agg as agg
- class Graph():
- def __init__(self, x, y, z, k, a, b):
- self.x = x
- self.y = y
- fig, (ax1, ax2, ax3) = plt.subplots(
- nrows=1, ncols=3,
- figsize=(8, 4)
- )
- ax1.plot(x, y)
- ax1.spines['left'].set_position('center')
- ax1.spines['bottom'].set_position('center')
- ax1.spines['top'].set_visible(False)
- ax1.spines['right'].set_visible(False)
- ax2.plot(z, k)
- ax2.spines['left'].set_position('center')
- ax2.spines['bottom'].set_position('center')
- ax2.spines['top'].set_visible(False)
- ax2.spines['right'].set_visible(False)
- ax3.plot(a, b)
- ax3.spines['left'].set_position('center')
- ax3.spines['bottom'].set_position('center')
- ax3.spines['top'].set_visible(False)
- ax3.spines['right'].set_visible(False)
- def draw_graph(self):
- # Добавление графика fig на холст
- canvas = agg.FigureCanvasAgg(self.fig)
- # Отрисовка холста
- canvas.draw()
- # Рендер
- renderer = canvas.get_renderer()
Advertisement
Add Comment
Please, Sign In to add comment