Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2014

Conversation

sinhrks
Copy link
Member

@sinhrks 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

@sinhrks
Copy link
Member Author

sinhrks commented Jul 24, 2014

Rebased. I think this can be reviewed.

jreback added a commit that referenced this pull request Jul 24, 2014
BUG: Repeated timeseries plot may result in incorrect kind
@jreback jreback merged commit bfa9bc5 into pandas-dev:master Jul 24, 2014
@jreback
Copy link
Contributor

jreback commented Jul 24, 2014

thanks!

@sinhrks sinhrks deleted the tsplot_bug branch July 25, 2014 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants