## [Matplotlib-users] How to plot a set of line segments

 [Matplotlib-users] How to plot a set of line segments From: John Salvatier - 2010-12-10 20:13:34 Attachments: Message as HTML ```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 ```

 [Matplotlib-users] How to plot a set of line segments From: John Salvatier - 2010-12-10 20:13:34 Attachments: Message as HTML ```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 ```
 Re: [Matplotlib-users] How to plot a set of line segments From: Chloe Lewis - 2010-12-10 20:34:26 ```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@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ```
 Re: [Matplotlib-users] How to plot a set of line segments From: John Salvatier - 2010-12-10 20:43:28 Attachments: Message as HTML ```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 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@... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > ```