How to plot a set of line segments

I have a set of records with (start, end, value) values. Basically they represent “we had this value between these two times”. The end of one record is not necessarily the end of another record.

I would like to plot a set of line segments with end points (x=start, y= value) and (x=end, y=value), so I will have time on the x axis and value on the y axis.

Does anyone have any ideas on how I could do this? I would really like my line segments not to be connected, so I don’t want to use a line plot or xyplot.

Best Regards,

John Salvatier

You can plot them all individually; e.g.

rec = ([1,2,.5], [0.5, 3, 1.1], [5, 7, .2])
for r in rec:
     pylab.plot( r[:2], [r[2]]*2)

···

On Dec 10, 2010, at 12:13 PM, John Salvatier wrote:

I have a set of records with (start, end, value) values. Basically they represent "we had this value between these two times". The end of one record is not necessarily the end of another record.

I would like to plot a set of line segments with end points (x=start, y= value) and (x=end, y=value), so I will have time on the x axis and value on the y axis.

Does anyone have any ideas on how I could do this? I would really like my line segments not to be connected, so I don't want to use a line plot or xyplot.

Best Regards,
John Salvatier
------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages,
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Ah, yes, I should have added that I have a lot of them, so this seems like improper usage. I found the collections.LineCollection class which sounds like what I want.

Thank you for the help,

John

···

On Fri, Dec 10, 2010 at 12:34 PM, Chloe Lewis <chlewis@…2999…16…> wrote:

You can plot them all individually; e.g.

rec = ([1,2,.5], [0.5, 3, 1.1], [5, 7, .2])

for r in rec:

pylab.plot( r[:2], [r[2]]*2)

On Dec 10, 2010, at 12:13 PM, John Salvatier wrote:

I have a set of records with (start, end, value) values. Basically they represent “we had this value between these two times”. The end of one record is not necessarily the end of another record.

I would like to plot a set of line segments with end points (x=start, y= value) and (x=end, y=value), so I will have time on the x axis and value on the y axis.

Does anyone have any ideas on how I could do this? I would really like my line segments not to be connected, so I don’t want to use a line plot or xyplot.

Best Regards,

John Salvatier


Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,

new data types, scalar functions, improved concurrency, built-in packages,

OCI, SQL*Plus, data movement tools, best practices and more.

http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users