Guest User

Untitled

a guest
Feb 17th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. label = r'$frac{d^2y}{dx^2}$'
  2.  
  3. import numpy as np
  4. import matplotlib.pyplot as plt
  5.  
  6. x = np.linspace(1, 10, 10)
  7. y = x
  8.  
  9. def f(x, y, n):
  10. """ """
  11. fig, ax = plt.subplots()
  12. if n == 1:
  13. label = r'$frac{dy}{dx} = 0$'
  14. else:
  15. numerator = 'd^{}y'.format(n)
  16. denominator = 'dx^{}'.format(n)
  17. # label = r'$frac{}{}$'.format(numerator, denominator)
  18. # label = '$frac{}{}$'.format(numerator, denominator)
  19. # label = '$frac{numerator}{denominator}$'
  20. label = r'$frac{numerator}{denominator}$'
  21. ax.scatter(x, y, c='r', marker='.', s=5, label=label)
  22. ax.legend(loc='upper left')
  23. plt.show()
  24. plt.close(fig)
  25.  
  26. f(x, y, n=1)
  27. f(x, y, n=2)
Add Comment
Please, Sign In to add comment