If your collection of points is a numpy array, you can use the column of y-coordinates as the first argument to the plotting function hlines. E.g, inside ipython --pylab:

ptn = array(([1,1],[3,1],[2,4],[4,4]))
hlines(ptn[:,1], -1, 1) 

But at that point the horizontal lines are on the edges of the axis, not visible. This forces them to show:

plot([-1, 0, 1],[0.5, 2.5, 4.5])

but perhaps you only want the hlines. What I usually do in a script or function is name all my axes and twiddle their limits in an aesthetic way, but in ipython the following isn't redrawing the plot, for me:

a = gca()
curlims = a.get_ylim()                  
a.set_ylim([curlims[0] - 0.1, curlims[1] + 0.1])

half-finished, but I hope it helps,

&C

On Jul 13, 2009, at 13 Jul, 11:56 AM, Afi Welbeck wrote:

Hi,

I'm a newbie, and I'm trying to plot horizontal
lines with the following  points:
[1,1], [3,1], [2,4] and [4,4].

Also, is there a way of putting them together in
lists, (say the pair of points that plot one horizontal line )
for easy plotting? Could anyone please help me with the
code? Thanks.

Regards,
Harriet A. Welbeck


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: 
http://p.sf.net/sfu/Challenge_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Chloe Lewis
Graduate student, Amundson Lab
Division of Ecosystem Sciences, ESPM
University of California, Berkeley
137 Mulford Hall - #3114
Berkeley, CA  94720-3114
chle...@nature.berkeley.edu





------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to