Hello all,

 

I've been trying to use the volume_overlay functions from matplotlib.finance without luck.

Is anyone using it?

 

Below is a simple test program. When I run it, all the volume bars have the same height.

 

Thanks,

 

Christophe

 

#!/usr/bin/env python

from pylab import *

from matplotlib.dates import  DateFormatter, WeekdayLocator, HourLocator, \

     DayLocator, MONDAY, timezone

from matplotlib.finance import volume_overlay3

 

 

mondays = WeekdayLocator(MONDAY)        # major ticks on the mondays

alldays    = DayLocator()              # minor ticks on the days

weekFormatter = DateFormatter('%b %d')  # Eg, Jan 12

dayFormatter = DateFormatter('%d')      # Eg, 12

 

quotes = [(733456.33402777778, 129.5994, 130.0, 130.55000000000001, 129.5, 6178), (733456.33472222218, 129.75, 129.30000000000001, 129.75, 129.30000000000001, 9109), (733456.3354166667, 129.5, 130.0, 130.0, 129.5, 7548), (733456.3361111111, 130.0, 130.0, 130.0, 130.0, 8039), (733456.3368055555, 130.05000000000001, 130.15000000000001, 130.30000000000001, 130.05000000000001, 9633), (733456.33750000002, 130.40000000000001, 130.15000000000001, 130.59999999999999, 130.15000000000001, 2103), (733456.33819444443, 130.15000000000001, 130.44999999999999, 130.44999999999999, 130.15000000000001, 5428), (733456.33888888895, 130.44999999999999, 130.30000000000001, 130.44999999999999, 130.30000000000001, 2025), (733456.33958333335, 130.30000000000001, 130.15000000000001, 130.55000000000001, 130.15000000000001, 3429), (733456.34027777775, 128.90000000000001, 130.05000000000001, 130.09999999999999, 128.90000000000001, 1268), (733456.34097222227, 130.09999999999999, 130.19800000000001, 130.19800000000001, 130.05000000000001, 2891), (733456.34166666667, 130.19999999999999, 130.34999999999999, 130.34999999999999, 130.19999999999999, 1093), (733456.34236111108, 130.40000000000001, 130.44999999999999, 130.5, 130.40000000000001, 1102)]

 

fig = figure()

fig.subplots_adjust(bottom=0.2)

ax = fig.add_subplot(111)

ax.xaxis.set_major_locator(mondays)

ax.xaxis.set_minor_locator(alldays)

ax.xaxis.set_major_formatter(weekFormatter)

ax.xaxis.set_minor_formatter(dayFormatter)

 

volume_overlay3(ax, quotes)

 

ax.xaxis_date()

ax.autoscale_view()

setp( gca().get_xticklabels(), rotation=45, horizontalalignment='right')

 

show()