Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- a=float(input('a='))#1
- b=float(input('b='))#1
- c=float(input('c='))#1
- dx=float(input('dx='))#0.2
- x=np.arange(1,2*np.pi,dx)
- fig,axs = plt.subplots(2,2,figsize=(12,7))
- plt.subplots_adjust(hspace=0.4)
- plt.suptitle('suptitle')
- plt.figtext(0.05,0.9,'figtext')
- axs[0,0].plot(x,np.sqrt((1.2*a+c*np.log(x))/2/b*np.exp(x)),'o-r')
- axs[0,1].plot(x,np.sin(x)+0.1*b**2+c*np.exp(np.cos(x)),'--g')
- axs[1,0].plot(x,a*(b+c)/(2*x**2+x+0.6)*np.sin(x)+np.exp(a),'<m')
- axs[1,1].plot(x,b/(a*x**2+3)+np.log(b)*np.sin(x**3)+c,'-.')
- props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)
- axs[0,0].text(1,25, 'text 1', bbox=props)
- axs[0,1].text(1,0, 'text 2', bbox=props)
- axs[1,0].text(1,2.7, 'text 3', bbox=props)
- axs[1,1].text(1,1.05, 'text 4', bbox=props)
- axs[0,0].annotate('graph 1', xy=(3, 5), xycoords='data',
- xytext=(0.8, 0.95), textcoords='axes fraction',
- arrowprops=dict(facecolor='black', shrink=0.05),
- horizontalalignment='right', verticalalignment='top',
- )
- axs[0,1].annotate('graph 2', xy=(4, 0.01), xycoords='data',
- xytext=(0.8, 0.95), textcoords='axes fraction',
- arrowprops=dict(facecolor='black', shrink=0.05),
- horizontalalignment='right', verticalalignment='top',
- )
- axs[1,0].annotate('graph 3', xy=(4, 2.67), xycoords='data',
- xytext=(0.8, 0.95), textcoords='axes fraction',
- arrowprops=dict(facecolor='black', shrink=0.05),
- horizontalalignment='right', verticalalignment='top',
- )
- axs[1,1].annotate('graph 4', xy=(4, 1.05), xycoords='data',
- xytext=(0.8, 0.95), textcoords='axes fraction',
- arrowprops=dict(facecolor='black', shrink=0.05),
- horizontalalignment='right', verticalalignment='top',
- )
- axs[0, 0].set_title("Title 1")
- axs[0, 1].set_title("Title 2")
- axs[1, 0].set_title("Title 3")
- axs[1, 1].set_title("Title 4")
- axs[0,0].set_xlabel('x')
- axs[0,0].set_ylabel('y', color='red')
- axs[0,1].set_xlabel('x')
- axs[0,1].set_ylabel('y', color='green')
- axs[1,0].set_xlabel('x')
- axs[1,0].set_ylabel('y', color='purple')
- axs[1,1].set_xlabel('x')
- axs[1,1].set_ylabel('y', color='blue')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment