Folks, I'm trying to use BrokenBarHCollection with pandas timeseries object.
Here's a minimal example: (python 3.3, pandas 0.15.1, matplotlib 1.4.2) #----------------------------------------------------- import pandas as pd import numpy as np from datetime import datetime as dt import matplotlib.pyplot as plt import matplotlib.collections as collections span_where = collections.BrokenBarHCollection.span_where # init the dataframe time = pd.date_range(pd.datetime(1950,1,1), periods=5, freq='MS') df = pd.DataFrame(np.arange(5), index=time, columns=['data']) df['cond'] = df['data'] == 3 # Make the plot fig = plt.figure() ax = fig.add_subplot(111) df['data'].plot(ax=ax, c='black') c = span_where(df.index, ymin=0, ymax=4, where=df['cond'], facecolor='green', alpha=0.5) #----------------------------------------------------- I get the error: "TypeError: float() argument must be a string or a number" Basically, span_where() is not happy with my x values which are a panda timeserie. I tried several stuffs (df.index.to_*) but there is something I still don't get in the internal representation of dates in matplolib. Any hint? Thanks a lot! Fabien ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users