Skip to content

TST pandas support bar #13255

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
Jan 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,26 @@ def test_bar_timedelta():
(10, 20))


def test_bar_pandas(pd):
# Smoke test for pandas

fig, ax = plt.subplots()

df = pd.DataFrame(
{'year': [2018, 2018, 2018],
'month': [1, 1, 1],
'day': [1, 2, 3],
'value': [1, 2, 3]})
df['date'] = pd.to_datetime(df[['year', 'month', 'day']])

monthly = df[['date', 'value']].groupby(['date']).sum()
dates = monthly.index
forecast = monthly['value']
baseline = monthly['value']
ax.bar(dates, forecast, width=10, align='center')
ax.plot(dates, baseline, color='orange', lw=4)


@image_comparison(baseline_images=['hist_log'],
remove_text=True)
def test_hist_log():
Expand Down