From: <kc1...@ya...> - 2007-03-07 17:59:58
|
Upon working with this a little further, I discover that it works only in f= ull-view screen mode. May be that's because xy is in pixel mode then? Whe= n I save it to a png file and then view it, the lines are wrong.=0A =0A--= =0AJohn Henry=0A=0A----- Original Message ----=0AFrom: "kc106_2005-matplotl= ib...@ya..." <kc1...@ya...>=0ATo: matplotlib-users@list= s.sourceforge.net=0ASent: Wednesday, March 7, 2007 9:40:45 AM=0ASubject: Re= : [Matplotlib-users] How to draw a straight line?=0A=0AThanks for the answe= r, John and Jouni.=0A=0AOkay, Line2D works. However, it appears to work in= point (or is it pixels?) only. It doesn't accept xycoords=3D"figure fract= ion" as an option. How can I specify xy as a fraction of the figure size?= =0A=0AI read the transform cookbook cited by Jouni. I am afraid I am lost = what that does....=0A=0ARegards,=0A=0A> -----Original Message-----=0A> From= : mat...@li... =0A> [mailto:matplotlib-us= ers...@li...] On =0A> Behalf Of John Hunter=0A> Sent: = Wednesday, March 07, 2007 6:48 AM=0A> To: mat...@li...urceforg= e.net=0A> Subject: Re: [Matplotlib-users] How to draw a straight line?=0A> = =0A> =0A> On 3/6/07, Jouni K. Sepp=E4nen <jk...@ik...> wrote:=0A> > kc106_20= 05-...@ya... writes:=0A> > > How do I draw a line going from poi= nt A to point B on a =0A> figure (not=0A> =0A> It probably makes more sense= not to use Axes.plot at all, =0A> since the line is not associated with an= Axes=0A> =0A> from matplotlib.lines import Line2D=0A> from pylab import fi= gure, show, nx=0A> =0A> fig =3D figure()=0A> line =3D Line2D([100,200,300,4= 00,500], [100,400, 350, 200, 500],=0A> linewidth=3D4, color= =3D'green')=0A> fig.lines.append(line)=0A> show()=0A> =0A> =0A> But this fe= ature isn't used very much, and one thing that we =0A> are not currently su= pporting (but should) is the zorder for =0A> Artists in the Figure. So if = you have an Axes in your plot =0A> and you want the line to go over it, you= 'll need to do =0A> something like Jouni suggested so the line will be draw= n =0A> above the Axes.=0A> =0A> -------------------------------------------= -------------------=0A> -----------=0A> Take Surveys. Earn Cash. Influence = the Future of IT=0A> Join SourceForge.net's Techsay panel and you'll get th= e =0A> chance to share your opinions on IT & business topics through =0A> b= rief surveys-and earn cash =0A> http://www.techsay.com/default.php?page=3Dj= oin.php&p=3Dsourceforge=0A&CID=3DDEVDEV=0A_________________________________= ______________=0AMatplotlib-users mailing list Mat...@li...urc= eforge.net=0Ahttps://lists.sourceforge.net/lists/listinfo/matplotlib-users= =0A=0A =0A--=0AJohn Henry=0A=0A=0A=0A=0A |