Skip to content

Enable sorting groupby dimension values? #1463

Description

@maximlt

When setting groupby=..., the values of the dimensions displayed in the select widgets are not sorted by default. The workarounds are:

  1. pre-process the data to sort it
  2. set dynamic=False (default is True): HoloViews will internally instantiate a HoloMap (DynamicMap when dynamic=False) which sorts the values by default (MultiDimensionalMapping.sort is True by default).

When it comes to displaying large datasets, 1. is annoying and 2. is usually not available as setting dynamic=False on a rasterized/datashaded plot is mostly pointless.

Should hvPlot's default behavior be to sort the dimension values (requires holoviz/holoviews#6471)? If so, should we let users disable this? (keywords are easy to add but also come with some drawbacks).

import hvplot.pandas
import pandas as pd

N = 12
df = pd.DataFrame({
    'cat1': ['A', 'A', 'A', 'A', 'C', 'C', 'C', 'C', 'B', 'B', 'B', 'B'],
    'cat2': ['y', 'y', 'x', 'x', 'y', 'y', 'x', 'x','y', 'y', 'x', 'x'],
    'x'  : range(N),
    'y'  : range(N),
})

df.hvplot.scatter('x', 'y', groupby=['cat1', 'cat2'])

Image

Activity

  1. locked and limited conversation to collaborators on May 12, 2025
  2. converted this issue into a discussion #1565 on May 12, 2025
  3. added
    [OLD] type: discussionOld labels for Discussion-type issues. Convert new Issues of this type to GitHub Discussions.
    on Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [OLD] type: discussionOld labels for Discussion-type issues. Convert new Issues of this type to GitHub Discussions.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions