Advertisement
Guest User

Latihan Pyplot

a guest
Mar 24th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. x = np.linspace(0, 2, 100)
  5. plt.plot(x, x, label='x')
  6. plt.plot(x, x**2, label='$x^2$')
  7. plt.plot(x, x**3, label='x^3')
  8. plt.xlabel('x label')
  9. plt.ylabel('y label')
  10. plt.title("Simple Plot")
  11. plt.legend()
  12. plt.show()
  13.  
  14. x = np.linspace(0, 2, 10)
  15. plt.plot(x, x, label='x')
  16. plt.plot(x, x**2, 'ro', label='$x^2$')
  17. plt.plot(x, x**3, label='x^3')
  18. plt.xlabel('x label')
  19. plt.ylabel('y label')
  20. plt.title("Simple Plot")
  21. plt.legend()
  22. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement