Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. import matplotlib
  2.  
  3. matplotlib.use('QT5Agg')
  4. import matplotlib.pyplot as plt
  5. import numpy as np
  6.  
  7. a = np.arange(5)
  8. b = np.arange(5, -4, -1)
  9. c = np.arange(-4, 7, .5)
  10. d = np.arange(7, 2, -1)
  11. e = np.arange(2, 6, .2)
  12. f = np.arange(6, -3, -1)
  13. g = np.arange(-3, 2, .25)
  14.  
  15. r1 = np.append(a, b)
  16. r2 = np.append(r1, c)
  17. r3 = np.append(r2, d)
  18. r4 = np.append(r3, e)
  19. r5 = np.append(r4, f)
  20. r6 = np.append(r5, g)
  21.  
  22. plt.rcParams['font.size'] = 6
  23.  
  24. fig, ax1 = plt.subplots()
  25. ax1.plot(r6,'g-o',markersize=3)
  26.  
  27.  
  28.  
  29. plt.annotate('start upward', xy=(0,0), textcoords='data',)
  30. plt.annotate('end upward', xy=(3,3), textcoords='data',)
  31.  
  32. plt.annotate('start downward', xy=(5,5), textcoords='data',)
  33. plt.annotate('end downward', xy=(7,3), textcoords='data',)
  34.  
  35. plt.annotate('start upward', xy=(14,-4), textcoords='data',)
  36. plt.annotate('end upward', xy=(20,-1), textcoords='data',)
  37.  
  38. plt.annotate('start downward', xy=(36,7), textcoords='data',)
  39. plt.annotate('end downward', xy=(38,5), textcoords='data',)
  40.  
  41. plt.annotate('start upward', xy=(41,2), textcoords='data',)
  42. plt.annotate('end upward', xy=(56,5), textcoords='data',)
  43.  
  44. plt.annotate('start downward', xy=(61,6), textcoords='data',)
  45. plt.annotate('end downward', xy=(63,4), textcoords='data',)
  46.  
  47. plt.annotate('start upward', xy=(70,-3), textcoords='data',)
  48. plt.annotate('end upward', xy=(82,0), textcoords='data',)
  49.  
  50. ax1.minorticks_on()
  51. ax1.grid(b=True, which='major', color='g', linestyle='-')
  52. ax1.grid(b=True, which='minor', color='y', linestyle='--')
  53. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement