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

enh: Add select to ImageStack #6437

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

enh: Add select to ImageStack #6437

wants to merge 1 commit into from

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Nov 4, 2024

Improves the issue described here: holoviz-topics/examples#430 (comment)

The current implementation is pretty rough around the edges...

image

import datashader as ds
import holoviews as hv
import numpy as np
import pandas as pd
from holoviews.operation.datashader import rasterize

hv.extension("bokeh")

num = 10000
np.random.seed(1)

dists = {
    cat: pd.DataFrame({
        "x": np.random.normal(x, s, num),
        "y": np.random.normal(y, s, num),
        "s": s,
        "val": val,
        "cat": cat,
    })
    for x, y, s, val, cat in [
        (2, 2, 0.03, 0, "d1"),
        (2, -2, 0.10, 1, "d2"),
        (-2, -2, 0.50, 2, "d3"),
        (-2, 2, 1.00, 3, "d4"),
        (0, 0, 3.00, 4, "d5"),
    ]
}

df = pd.concat(dists, ignore_index=True)

points = hv.Points(df)
plot = rasterize(points, aggregator=ds.count_cat("cat"))

plot + plot.select(cat=["d1", "d3"])

@hoxbro hoxbro marked this pull request as draft November 4, 2024 12:00
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 11.11111% with 8 lines in your changes missing coverage. Please review.

Project coverage is 88.49%. Comparing base (366d932) to head (7233cc2).

Files with missing lines Patch % Lines
holoviews/element/raster.py 11.11% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6437      +/-   ##
==========================================
- Coverage   88.50%   88.49%   -0.02%     
==========================================
  Files         323      323              
  Lines       68627    68636       +9     
==========================================
+ Hits        60737    60738       +1     
- Misses       7890     7898       +8     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant