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

Allow algorithm as str input to downsample operation #1314

Merged
merged 4 commits into from
Apr 16, 2024
Merged

Conversation

droumis
Copy link
Member

@droumis droumis commented Apr 15, 2024

fixes #1312

This pull request updates the handling of the downsample parameter in hvPlot. Previously, the parameter only accepted a boolean value. With these changes, users can now specify the downsampling algorithm directly, provided they have 'tsdownsample' library installed.

"""
downsample (default=False):
        Controls the application of downsampling to the plotted data,
        which is particularly useful for large timeseries datasets to
        reduce the amount of data sent to browser and improve
        visualization performance. Requires HoloViews >= 1.16. Additional
        dependencies: Installing the `tsdownsample` library is required
        for using any downsampling methods other than the default 'lttb'.
        Acceptable values:
        - False: No downsampling is applied.
        - True: Applies downsampling using HoloViews' default algorithm
            (LTTB - Largest Triangle Three Buckets).
        - 'lttb': Explicitly applies the Largest Triangle Three Buckets
          algorithm.
        - 'minmax': Applies the MinMax algorithm, selecting the minimum
          and maximum values in each bin. Requires `tsdownsample`.
        - 'm4': Applies the M4 algorithm, selecting the minimum, maximum,
          first, and last values in each bin. Requires `tsdownsample`.
        - 'minmax-lttb': Combines MinMax and LTTB algorithms for
          downsampling, first applying MinMax to reduce to a preliminary
          set of points, then LTTB for further reduction. Requires
          `tsdownsample`.
        Other string values corresponding to supported algorithms in
        HoloViews may also be used.
"""
  • add tests
  • add docs (already in large timeseries nb)

@droumis droumis marked this pull request as ready for review April 15, 2024 22:12
@droumis droumis requested a review from maximlt April 15, 2024 22:17
@droumis droumis self-assigned this Apr 15, 2024
@droumis droumis added the type: enhancement New feature or request label Apr 15, 2024
Copy link
Member

@maximlt maximlt left a comment

Choose a reason for hiding this comment

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

LGTM! The day we need to allow configuring more downsample1d we can still overload downsample to accept a dict, for now this looks way more than enough. Thanks!

@maximlt maximlt merged commit 4e02ff0 into main Apr 16, 2024
9 checks passed
@maximlt maximlt deleted the downsample-algos branch April 16, 2024 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose more downsample algorithms and options
2 participants