BUG: Repeated timeseries plot may result in incorrect kind #7733

Merged
merged 1 commit into from Jul 24, 2014

Conversation

Projects
None yet
2 participants
Member

sinhrks commented Jul 12, 2014

Must be revisited after #7717.

Repeated line and area plot may result incorrect if it requires resampling.

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

fig, axes = plt.subplots(2, 2, figsize=(7, 5))
np.random.seed(1)

df1 = pd.DataFrame(np.random.rand(5, 2), pd.date_range('2011-01-01', periods=5, freq='D'))
df2 = pd.DataFrame(np.random.rand(2, 2), pd.date_range('2011-01-01', periods=2, freq='M'))

df1.plot(kind='line', ax=axes[0][0], legend=False)
df2.plot(kind='area', ax=axes[0][0], legend=False)

df1.plot(kind='area', ax=axes[1][0], legend=False)
df2.plot(kind='line', ax=axes[1][0], legend=False)

df2.plot(kind='line', ax=axes[0][1], legend=False)
df1.plot(kind='area', ax=axes[0][1], legend=False)
# ValueError: Argument dimensions are incompatible

df2.plot(kind='area', ax=axes[1][1], legend=False)
df1.plot(kind='line', ax=axes[1][1], legend=False)

Result using current master

  • line with low freq -> area with high freq results in ValueError (top-right axes)
  • area with low freq -> line with high freq results in all lines, not area (bottom-right axes)
    figure_ng

Result after fix

figure_ok

jreback added this to the 0.15.0 milestone Jul 14, 2014

Member

sinhrks commented Jul 24, 2014

Rebased. I think this can be reviewed.

@jreback jreback added a commit that referenced this pull request Jul 24, 2014

@jreback jreback Merge pull request #7733 from sinhrks/tsplot_bug
BUG: Repeated timeseries plot may result in incorrect kind
bfa9bc5

@jreback jreback merged commit bfa9bc5 into pandas-dev:master Jul 24, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
Contributor

jreback commented Jul 24, 2014

thanks!

sinhrks deleted the sinhrks:tsplot_bug branch Jul 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment