SHARE
TWEET

Latihan Pyplot

a guest Mar 24th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top