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

Enhancement: Expose the "truncate_mode" parameter of scipy.cluster.hierarchy.dendrogram() in seaborn.matrix.clustermap() #3525

Closed
YuanfengZhang opened this issue Oct 18, 2023 · 2 comments
Labels

Comments

@YuanfengZhang
Copy link

  1. The dendrogram is usually hard to read when the dataframe to draw the linkage is large, or it's too complex to show in the limited figure space sometime.
  2. The workaround of preparing own linkage for the clustermap is kind of exhilarating and frustrating for users.

It would be very helpful for users drawing sns.clustermap with this parameter.
Thanks for your devotion and help.

Excepted:

sns.clustermap(*, truncate_mode: Optional[str] =None)

Todo:

  1. add "self.truncate_mode" property at
    class _DendrogramPlotter:
  2. add "self.truncate_mode" paramter at
    return hierarchy.dendrogram(self.linkage, no_plot=True,
  3. add "self.truncate_mode" paramter at
    def dendrogram(

    plotter = _DendrogramPlotter(data, linkage=linkage, axis=axis,

    def plot_dendrograms(self, row_cluster, col_cluster, metric, method,

    self.dendrogram_row = dendrogram(

    self.dendrogram_col = dendrogram(

    def plot(self, metric, method, colorbar_kws, row_cluster, col_cluster,

    self.plot_dendrograms(row_cluster, col_cluster, metric, method,

    def clustermap(

    row_colors=None, col_colors=None, mask=None,
@mwaskom
Copy link
Owner

mwaskom commented Nov 4, 2023

I am probably -1 on exposing individual parameters like this but don't immediately see why it wouldn't be possible to pass along a dictionary of such parameters. I feel like this has certainly been discussed before and I am actually a little surprised that this is not supported already which makes me think I'm missing something about why it would be complicated. Note that there would need to be two separate parameters for the row / col clustering to align with the rest of the interface.

Note that my real preference w/r/t clustermap is spinning it out of seaborn altogether as I don't think it fits well with the current direction of the library / API. But I've not found maintainers to adopt it.

@YuanfengZhang
Copy link
Author

I am probably -1 on exposing individual parameters like this but don't immediately see why it wouldn't be possible to pass along a dictionary of such parameters. I feel like this has certainly been discussed before and I am actually a little surprised that this is not supported already which makes me think I'm missing something about why it would be complicated. Note that there would need to be two separate parameters for the row / col clustering to align with the rest of the interface.

Note that my real preference w/r/t clustermap is spinning it out of seaborn altogether as I don't think it fits well with the current direction of the library / API. But I've not found maintainers to adopt it.

Thanks for the clarification. I understand it and 'm closing this issue.

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

No branches or pull requests

2 participants