OK I just filled a bug report:
https://github.com/matplotlib/matplotlib/issues/3872

my first bug report ever!


On 02.12.2014 17:15, Fabien wrote:
> On 02.12.2014 16:59, Benjamin Root wrote:
>> Does the workaround posted here fix things for you?
>> https://github.com/matplotlib/matplotlib/issues/3727#issuecomment-60899590
>
> sorry it doesn't.
>
> I updated the test case below (including the workaround, I hope I got it
> right). The strange thing is that fill_between() works fine, but
> pan_where() is the problem.
>
> Thanks!
>
> #-------------------------------------------
> 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
> import matplotlib.units as units
>
> units.registry[np.datetime64] = pd.tseries.converter.DatetimeConverter()
>
> # 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
>
> # This is working (but its not what I want)
> x = np.arange(5)
> fig = plt.figure()
> ax = fig.add_subplot(111)
> plt.plot(x, df['data'], 'k')
> c = span_where(x, ymin=0, ymax=4, where=df['cond'], color='green')
> ax.add_collection(c)
> plt.show()
>
> #This is not
> x = df.index.values
> fig = plt.figure()
> ax = fig.add_subplot(111)
> plt.plot(x, df['data'], 'k')
> c = span_where(x, ymin=0, ymax=4, where=df['cond'], color='green')
> ax.add_collection(c)
> plt.show()
>
> #This is producing an error
> x = df.index
> fig = plt.figure()
> ax = fig.add_subplot(111)
> plt.plot(x, df['data'], 'k')
> c = span_where(x, ymin=0, ymax=4, where=df['cond'], color='green')
> ax.add_collection(c)
> plt.show()
> #-------------------------------------------




------------------------------------------------------------------------------
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=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to