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

Reply via email to