matplotlib
from matplotlib import pyplot as plt
plt.plot([1,2,6],[4,6,1])
plt.show()
# how to label the graph??
x=[1,2,3,4]
y=[5,6,7,8]
plt.plot(x,y)
plt.title("graph of x and y")
plt.xlabel("input")
plt.ylabel("output")
plt.show()
plotting of 2 lines with stling of line
from matplotlib import pyplot as plt
from matplotlib import style
x=[1,2,3,4]
y=[0,3,2,8]
x1=[4,5,6,9]
y1=[4,5,2,9]
plt.plot(x,y,'g',label="1st line",linewidth=5)
plt.plot(x1,y1,'c',label="2nd line",linewidth=4)
plt.title('2 lines')
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.legend()
plt.grid(True,color='k')
plt.show()
Comments
Post a Comment