PYTHON: matplotlib, creating two graphs in a same panel

PYTHON: matplotlib, creating two graphs in a same panel


PYTHON: matplotlib, creating two graphs in a same panel

programme code:

 import matplotlib.pyplot as plt
import numpy as np
e = np.arange(-5,5,0.01)
f = np.sin(e)
z  = e**2 + e*5 + 2

plt.subplot(2,2,1)
plt.plot(e,f,'r--')
plt.ylabel('y-axis')
plt.xlabel('x-axis')
plt.title('anikets graph-1')

plt.subplot(2,2,2)
plt.plot(e,z,'g--')
plt.ylabel('y-axis')
plt.xlabel('x-axis')
plt.title('anikets graph-1')

plt.show()


output:
PYTHON: matplotlib, creating two graphs in a same panel



 

Post a Comment

0 Comments