Skip to main content

plot_xy.py


import matplotlib.pyplot as plt
x=[1,2,3,4]
y=[0.8, 2.1, 1.2, 4.3]
xmin=0
xmax=8
ymin=-2
ymax=7
plt.plot(x,y,'r--^')    # create the plot
plt.axis([xmin,xmax,ymin,ymax])
plt.xlabel('x')
plt.ylabel('y')
plt.show()       # show the plot