Skip to content

fill_between() doesn't work with DatetimeIndex #225

Description

@oguzhanogreden

Description

When DatetimeIndex is used for x axis in fill_between, the wrapper doesn't work.

Steps to reproduce

import proplot as plot
import pandas as pd

df = pd.DataFrame(1, index=pd.date_range('2020-09-01', '2020-09-02', freq='1H'), columns=['test'])
_, axes = plot.subplots()

axes.plot(df)

axes.fill_between(
    df.index,
    df['test'] + 1,
    df['test'] + 1.1,
)

# Raises `TypeError: '<' not supported between instances of 'Timestamp' and 'float'`

I expect this to be possible, it's quite a common use case for my use.

Equivalent steps in matplotlib

import matplotlib as mpl
import matplotlib.pyplot as plt

import pandas as pd

mpl.__version__ # 3.3.1

df = pd.DataFrame(1, index=pd.date_range('2020-09-01', '2020-09-02', freq='1H'), columns=['test'])

axes = plt.subplot()

axes.plot(df)

axes.fill_between(
    df.index,
    df['test'] + 1,
    df['test'] + 1.1,
)

This works.

Proplot version

'0.6.4.post28'

I realise this isn't the latest, but I see that this file hasn't changed since this version. Let me know if you think an update can solve the issue and I'll give it a try.

Thanks! I really appreciate the comfort of using proplot - can't wait for the stable version! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions