[SciPy-user] plot vertical lines

Angus McMorland amcmorl at gmail.com
Mon Jul 13 08:31:17 EDT 2009


2009/7/13 Afi Welbeck <welby555 at yahoo.com>:
> Hi,
>
> I'm a newbie. I'm stuck trying to link the following
> points with vertical lines in the xy plane
> (1,1) (1,4)  and (3,2) (3,6)
>
> Could anyone please help me with the code?

Here's an verbose way to do it, so you can see what's going on. You'll
need matplotlib installed for this, and it's the generally recommended
2-d graphics package to accompany scipy.

import matplotlib.pyplot as plt
x0 = [1,1]
y0 = [1,4]
x1 = [3,3]
y1 = [2,6]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x0, y0, x1, y1)
ax.set_xlim([0, 4])
ax.set_ylim([0, 7])
plt.show()

Hoping that helps,

Angus.
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh



More information about the SciPy-User mailing list