Guest User

Untitled

a guest
Jul 18th, 2022
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. from matplotlib import pyplot as plt
  2. import numpy as np
  3.  
  4. xPoints = np.array([2, 4, 6, 8, 10, 12, 14, 16, 18, 20])
  5. y1Points = np.array([12, 14, 16, 18, 10, 12, 14, 16, 18, 120])
  6. y2Points = np.array([12, 7, 6, 5, 4, 3, 2, 2, 1, 12])
  7.  
  8. plt.subplot(2, 1, 1) # row 1, col 2 index 1
  9. plt.plot(xPoints, y1Points)
  10. plt.title("My first plot!")
  11. plt.xlabel('X-axis ')
  12. plt.ylabel('Y-axis ')
  13.  
  14. plt.subplot(2, 1, 2) # index 2
  15. plt.bar(xPoints, y2Points)
  16. plt.title("My second plot!")
  17. plt.xlabel('X-axis ')
  18. plt.ylabel('Y-axis ')
  19.  
  20. plt.show()
  21.  
Advertisement
Add Comment
Please, Sign In to add comment