Skip to content
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

Improve datetime support for hv.Bars #6365

Merged
merged 9 commits into from
Sep 24, 2024
Merged

Improve datetime support for hv.Bars #6365

merged 9 commits into from
Sep 24, 2024

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Aug 28, 2024

Todo:

  • Add tests
  • [ ] Improve padding Will postpone this for now
  • Look at matplotlib backend

Fixes #6364

import holoviews as hv
import pandas as pd

hv.extension("bokeh")

data = pd.DataFrame(
    {"x": pd.date_range("2017-01-01", "2017-01-03", tz="UTC"), "y": [0, 2, -1]}
)

bars = hv.Bars(data, ["x"], ["y"])
hv.Overlay([bars])

image


Fixes #6288

import datetime as dt

import holoviews as hv
import pandas as pd

data = pd.DataFrame(
    {
        "x": pd.to_datetime(
            [
                "2017-01-01T00:00:00",
                "2017-01-01T00:00:00",
                "2017-01-01T01:00:00",
                "2017-01-01T01:00:00",
            ]
        ),
        "cat": ["A", "B", "A", "B"],
        "y": [0, 1, 2, 3],
    }
)
hv.Bars(data, ["x", "cat"], ["y"]).opts(stacked=True)

image

--
Old issues which was fixed by the implementation.
Resolves #2156

@hoxbro hoxbro added the type: bug Something isn't correct or isn't working label Aug 28, 2024
Copy link

codecov bot commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.50%. Comparing base (6a96433) to head (67e55f2).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
holoviews/plotting/mpl/chart.py 88.88% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6365   +/-   ##
=======================================
  Coverage   88.49%   88.50%           
=======================================
  Files         323      323           
  Lines       68178    68204   +26     
=======================================
+ Hits        60336    60362   +26     
  Misses       7842     7842           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hoxbro hoxbro merged commit 1de5249 into main Sep 24, 2024
13 checks passed
@hoxbro hoxbro deleted the bars_fix branch September 24, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
2 participants