Vla_DOS

Untitled

Mar 27th, 2022
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.24 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. a=float(input('a='))#1
  4. b=float(input('b='))#1
  5. c=float(input('c='))#1
  6. dx=float(input('dx='))#0.2
  7. x=np.arange(1,2*np.pi,dx)
  8.  
  9. fig,axs = plt.subplots(2,2,figsize=(12,7))
  10. plt.subplots_adjust(hspace=0.4)
  11. plt.suptitle('suptitle')
  12. plt.figtext(0.05,0.9,'figtext')
  13.  
  14. axs[0,0].plot(x,np.sqrt((1.2*a+c*np.log(x))/2/b*np.exp(x)),'o-r')
  15. axs[0,1].plot(x,np.sin(x)+0.1*b**2+c*np.exp(np.cos(x)),'--g')
  16. axs[1,0].plot(x,a*(b+c)/(2*x**2+x+0.6)*np.sin(x)+np.exp(a),'<m')
  17. axs[1,1].plot(x,b/(a*x**2+3)+np.log(b)*np.sin(x**3)+c,'-.')
  18.  
  19. props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)
  20.  
  21. axs[0,0].text(1,25, 'text 1', bbox=props)
  22. axs[0,1].text(1,0, 'text 2', bbox=props)
  23. axs[1,0].text(1,2.7, 'text 3', bbox=props)
  24. axs[1,1].text(1,1.05, 'text 4', bbox=props)
  25.  
  26. axs[0,0].annotate('graph 1', xy=(3, 5),  xycoords='data',
  27.             xytext=(0.8, 0.95), textcoords='axes fraction',
  28.             arrowprops=dict(facecolor='black', shrink=0.05),
  29.             horizontalalignment='right', verticalalignment='top',
  30.             )
  31. axs[0,1].annotate('graph 2', xy=(4, 0.01),  xycoords='data',
  32.             xytext=(0.8, 0.95), textcoords='axes fraction',
  33.             arrowprops=dict(facecolor='black', shrink=0.05),
  34.             horizontalalignment='right', verticalalignment='top',
  35.             )
  36. axs[1,0].annotate('graph 3', xy=(4, 2.67),  xycoords='data',
  37.             xytext=(0.8, 0.95), textcoords='axes fraction',
  38.             arrowprops=dict(facecolor='black', shrink=0.05),
  39.             horizontalalignment='right', verticalalignment='top',
  40.             )
  41. axs[1,1].annotate('graph 4', xy=(4, 1.05),  xycoords='data',
  42.             xytext=(0.8, 0.95), textcoords='axes fraction',
  43.             arrowprops=dict(facecolor='black', shrink=0.05),
  44.             horizontalalignment='right', verticalalignment='top',
  45.             )
  46.  
  47. axs[0, 0].set_title("Title 1")
  48. axs[0, 1].set_title("Title 2")
  49. axs[1, 0].set_title("Title 3")
  50. axs[1, 1].set_title("Title 4")
  51. axs[0,0].set_xlabel('x')
  52. axs[0,0].set_ylabel('y', color='red')
  53. axs[0,1].set_xlabel('x')
  54. axs[0,1].set_ylabel('y', color='green')
  55. axs[1,0].set_xlabel('x')
  56. axs[1,0].set_ylabel('y', color='purple')
  57. axs[1,1].set_xlabel('x')
  58. axs[1,1].set_ylabel('y', color='blue')
  59. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment