Thanks, John. That works perfectly. Now I understand better what the transform parameter is.
Regards, > -----Original Message----- > From: John Hunter [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 07, 2007 10:12 AM > To: [EMAIL PROTECTED] > Cc: [email protected] > Subject: Re: [Matplotlib-users] How to draw a straight line? > > > On 3/7/07, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > > Upon working with this a little further, I discover that it > works only > > in full-view screen mode. May be that's because xy is in > pixel mode > > then? When I save it to a png file and then view it, the lines are > > wrong. > > The default coords in the example I posted are in pixels -- > when you save, you are probably using a different DPI (this > is configurable) and so the lines have slightly different > positions. You can use relative coords with the > "transFigure" transform > > > from matplotlib.lines import Line2D > from pylab import figure, show, nx > > fig = figure() > line = Line2D([0.1,0.2,0.3,0.4,0.5], [0.1,0.4, 0.35, 0.2, 0.5], > linewidth=4, color='green', transform=fig.transFigure) > fig.lines.append(line) > show() > -- John Henry ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
