Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added smoke tests for Axes.errorbar in test_datetime.py #27185

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 4 commits into from
Oct 25, 2023
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
35 changes: 32 additions & 3 deletions lib/matplotlib/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,40 @@ def test_contourf(self):
ax2.contourf(X_dates, Y_ranges, Z_ranges)
ax3.contourf(X_ranges, Y_dates, Z_ranges)

@pytest.mark.xfail(reason="Test for errorbar not written yet")
@mpl.style.context("default")
def test_errorbar(self):
fig, ax = plt.subplots()
ax.errorbar(...)
mpl.rcParams["date.converter"] = "concise"
fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1, layout="constrained")
limit = 7
start_date = datetime.datetime(2023, 1, 1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start_date seems unsed


x_dates = np.array([datetime.datetime(2023, 10, d) for d in range(1, limit)])
y_dates = np.array([datetime.datetime(2023, 10, d) for d in range(1, limit)])
x_date_error = datetime.timedelta(days=1)
y_date_error = datetime.timedelta(days=1)

x_values = list(range(1, limit))
y_values = list(range(1, limit))
x_value_error = 0.5
y_value_error = 0.5

ax1.errorbar(x_dates, y_values,
yerr=y_value_error,
capsize=10,
barsabove=True,
label='Data')
ax2.errorbar(x_values, y_dates,
xerr=x_value_error, yerr=y_date_error,
errorevery=(1, 2),
fmt='-o', label='Data')
ax3.errorbar(x_dates, y_dates,
xerr=x_date_error, yerr=y_date_error,
lolims=True, xlolims=True,
label='Data')
ax4.errorbar(x_dates, y_values,
xerr=x_date_error, yerr=y_value_error,
uplims=True, xuplims=True,
label='Data')

@pytest.mark.xfail(reason="Test for eventplot not written yet")
@mpl.style.context("default")
Expand Down