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

feat: Add dendrogram #6511

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft

feat: Add dendrogram #6511

wants to merge 18 commits into from

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Feb 18, 2025

resolves #6501

TODO:

  • Adjoint plot support responsive (will be done with: Improve responsive in adjoint layout for Bokeh backend #6527)
  • Adjoint plot weird height issue (problem: shared kdims in height axis: hv.Curve([]) << hv.Path([(0, 0), (1, 1)]) << hv.Path([(0, 0), (200, 200)]))
  • Add tests
  • Add examples
  • Don;t need to use Dendrogram(zip(...)) for creating the data
Screencast.From.2025-02-24.17-41-32.mp4
Details
import random

import pandas as pd
import panel as pn

import holoviews as hv

hv.extension("bokeh")
hv.opts.defaults(
    hv.opts.HeatMap(width=700, height=400, border=0, tools=["hover"]),
)
random.seed(1)


df = pd.DataFrame(
    [(i, chr(65 + j), random.random()) for j in range(10) for i in range(5)],
    columns=["z", "x", "y"]
)
dataset = hv.Dataset(df, vdims="y")  # TODO: Should not be needed

for adjoint_dims in (["x", "z"], ["x"], ["z"]):
    dendro = hv.operation.dendrogram(dataset, adjoint_dims=adjoint_dims, main_dim="y")
    pn.panel(dendro).servable()

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

Attention: Patch coverage is 31.16883% with 53 lines in your changes missing coverage. Please review.

Project coverage is 88.73%. Comparing base (2465ad1) to head (206ab68).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
holoviews/operation/element.py 21.62% 29 Missing ⚠️
holoviews/plotting/bokeh/path.py 14.28% 24 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6511      +/-   ##
==========================================
- Coverage   88.79%   88.73%   -0.07%     
==========================================
  Files         323      323              
  Lines       68949    69023      +74     
==========================================
+ Hits        61225    61246      +21     
- Misses       7724     7777      +53     

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

@droumis
Copy link
Member

droumis commented Feb 24, 2025

@hoxbro , is this ready for review?

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.

Add Dendrogram Element for hierarchical clustering
2 participants