Thanks. Unfortunately this gives me the same results: no good. Something is stripping whatever filler is there on the right.
text(xlim()[1],1.01,'string'.ljust(10,' '),horizontalalignment='right') John [H2O] wrote: > > > > Christopher Barrington-Leigh wrote: >> >> Hello. My problem is as follows: >> (ipython --pylab) >> >> from pylab import * >> pp=plot([0,0],[1,1]) >> text(xlim()[0],1,' Need padding ',horizontalalignment='left') >> text(xlim()[1],1,' Need padding ',horizontalalignment='right') >> >> >> The second case does not do what I want, which is to pad the text on the >> right. Text strings are stripped on the right, but no on the left. How >> can I elegantly create a character of space? >> >> Thanks! >> c >> > > Untested, but I think you could do this with just python builtin types: > > from pylab import * > pp=plot([0,0],[1,1]) > text(xlim()[0],1,'string'.ljust(10,' ')) > text(xlim()[1],1,'string'.rjust(10,' ')) > > See the documention: > http://docs.python.org/library/stdtypes.html > > str.ljust(width[, fillchar])ΒΆ > > Return the string left justified in a string of length width. Padding is > done using the specified fillchar (default is a space). The original > string is returned if width is less than len(s). > > Changed in version 2.4: Support for the fillchar argument. > > > -- View this message in context: http://www.nabble.com/trailing-space-in-text-string-stripped%2C-making-it-impossible-to-right-pad-my-text-tp25639703p25653331.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users