Skip to content

Added test for Axes.bar_label #27431

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 10 commits into from
Dec 7, 2023
15 changes: 12 additions & 3 deletions lib/matplotlib/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,20 @@ def test_bar(self):
fig, ax = plt.subplots()
ax.bar(...)

@pytest.mark.xfail(reason="Test for bar_label not written yet")
@mpl.style.context("default")
def test_bar_label(self):
fig, ax = plt.subplots()
ax.bar_label(...)
# Generate some example data with dateTime inputs
date_list = [datetime.datetime(2023, 1, 1) +
datetime.timedelta(days=i) for i in range(5)]
values = [10, 20, 15, 25, 30]

# Creating the plot
fig, ax = plt.subplots(1, 1, figsize=(10, 8), layout='constrained')
bars = ax.bar(date_list, values)

# Add labels to the bars using bar_label
ax.bar_label(bars, labels=[f'{val}%' for val in values],
label_type='edge', color='black')

@mpl.style.context("default")
def test_barbs(self):
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy