I am still investigating and I am stuck at converting transAxes values to data.
If my axes goes from 10.0 to 20.0 then transAxes 0.5 should give me 15.0. This would allow me to compute bar width and space, since I am able to convert inches to transAxes values. I tried many combinations of transAxes, transData, ..., inverse_xy_tup, xy_tup, inverted(), transform(), ... without success :( Any ideas please ? ----- import pylab as P import matplotlib.transforms as T x = P.arange(5) y = P.rand(5) * 4 ax = P.subplot(1,1,1) P.plot(x,y) ax.set_ylim(0.0, 4.0) trans = ax.transAxes valx = valy = 0.5 actualcoords = "%s" % trans.transform([valx, valy]) #Gives me [328, 240] instead of [2.0, 2.0] ax.text(valx, valy, actualcoords, transform=trans) P.show() ----- On Wed, Aug 13, 2008 at 10:34 AM, Mathieu Leplatre <[EMAIL PROTECTED]> wrote: > Hi all, > > I've searched in examples and archives and could not find anything > about manual control of space between bars. > > By default, the bars in the following script overlap. > > So I guess the behaviour is : > specify chart width (8in) + bar width (0.8) => auto bar space > > And I would like to know how to do : > specify chart width + bar space => auto bar width > specify bar space + bar width => auto chart width (fixed margins) > > But I can't figure it out, especially the latter. Can > matplotlib.transforms help me about the former ? > > Do you have documentation reference or some hints about that please ? > Thanks! > > I am plotting a chronological bar chart like this one : > > #!/usr/bin/env python > import matplotlib, pylab, numpy > import datetime > > def rangedates( hourstep ): > dates = [] > for d in range(1,31): > for h in range(0,24,hourstep): > dt = datetime.datetime(2008,06,d,h) > dates.append(dt) > return pylab.date2num(dates) > > # Plot value every 12H > abscissa = rangedates(12) > > barstep = abscissa[1] - abscissa[0] > barspace = 0.5 * barstep > barwidth = barstep - barspace > > fig = pylab.figure() > ax = fig.add_subplot(111) > fmt = matplotlib.dates.DateFormatter('%b %d') > ax.xaxis.set_major_formatter( fmt ) > fig.autofmt_xdate() > > pylab.bar( abscissa, numpy.random.randn( len(abscissa) ), > width = barwidth) > pylab.show() > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users