Advertisement
qberik

Untitled

Oct 30th, 2022
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. def task_1(self):
  2. """Первое задание"""
  3. self.ui.MainMenu.setCurrentIndex(1)
  4. fig = Figure(figsize=(5, 5))
  5. can = FigureCanvasQTAgg(fig)
  6. layout = QtWidgets.QVBoxLayout(self.ui.graphic)
  7. layout.addWidget(can)
  8.  
  9. # here you can set up your figure/axis
  10. ax = can.figure.add_subplot(111)
  11.  
  12. # plot a basic line plot from x and y values.
  13. ax.cla() # clears the axis
  14. x = np.arange(-10, 10, 0.1)
  15. y = np.cos(x) * np.cos(x) * np.cos(x) * np.sin(x)
  16. for i in range(0, len(y)):
  17. y[i] = y[i] - (5 * x[i]) / (np.sin(2 * x[i]) * np.cos(x[i]))
  18.  
  19. ax.plot(x, y)
  20. ax.grid(True)
  21. can.figure.tight_layout()
  22. can.draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement