- import matplotlib.pyplot as plt
- import numpy as np
- fig = plt.figure()
- ax = fig.add_subplot(111)
- d=[-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
- y=[]
- d1=[-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8]
- y1=[]
- for x in d:
- y+=[(x)/(x**2+x+5)]
- for x in d1:
- y1+=[((np.cos(x)+np.sin(x))/(x))]
- ax.plot(d,y,'r')
- ax.plot(d1,y1,'g')
- ax.legend(['funkcja1','funkcja2'])
- fig.suptitle('Wykreys funkcji xXx', fontsize=15, fontweight='bold')
- ax.set_xlabel('oś x')
- ax.set_ylabel('oś y')
- plt.show()