In [1]:
import matplotlib.pyplot as plt
In [2]:
p1 = [-3,-1]
p2 = [4,4]

plt.plot([p1[0],p2[0]],[p1[1],p2[1]],color=[.4,.2,.7],linewidth=5)

plt.axis('square')
plt.axis([-6,6,-6,6])
plt.show()
In [3]:
x = 3
y = 5

plt.plot(x,y,'ro')
plt.plot([0,x],[0,y],'r')


plt.axis('square')
plt.axis([-6,6,-6,6])
plt.grid()

plt.plot([-6,6],[0,0],'k')
plt.plot([0,0],[-6,6],'k')

plt.show
Out[3]:
<function matplotlib.pyplot.show(*args, **kw)>
In [4]:
x = range(-20,21)

for xi in x:
    plt.plot([0,xi],[0,abs(xi)**(1/2)])
In [5]:
plt.plot([0,2],[2,2],'r')
plt.plot([0,2],[0,0],'k')
plt.plot([0,0],[0,2],'g')
plt.plot([2,2],[0,2],'m')

plt.axis('square')
plt.axis([-3,5,-3,5])
plt.title('A Colorful Square')

plt.show()