question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing ax kwarg to clustermap results in duplicate arguments error

See original GitHub issue

Seems to be something similar to issue #414.

Working on the latest from master, I have code like this:

(figure, axes) = plt.subplots(figsize=(17,9))
axes.set_title(("Mean Monthly Temperature Cluster Map, 1894-2013\n"
                "Saint Francis, KS, USA"), fontsize=20)
_ = sns.clustermap(temps,
                   figsize=(17, 9),
                   cbar_kws={"label":
                             "Temperature\n(F)"},
                   ax=axes,
                   cmap=temps_cmap)

Which gives this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-44-4574ed2a089c> in <module>()
      7                              "Temperature\n(F)"},
      8                    ax=axes,
----> 9                    cmap=temps_cmap)

.venv-mmpl/lib/python3.4/site-packages/seaborn/matrix.py in clustermap(data, pivot_kws, method, metric, z_score, standard_scale, figsize, cbar_kws, row_cluster, col_cluster, row_linkage, col_linkage, row_colors, col_colors, mask, **kwargs)
    898                         row_linkage=row_linkage, col_linkage=col_linkage,
    899                         mask=mask,
--> 900                         **kwargs)

.venv-mmpl/lib/python3.4/site-packages/seaborn/matrix.py in plot(self, metric, method, colorbar_kws, row_cluster, col_cluster, row_linkage, col_linkage, mask, **kws)
    816 
    817         self.plot_colors(xind, yind, **kws)
--> 818         self.plot_matrix(colorbar_kws, mask, xind, yind, **kws)
    819         return self
    820 

.venv-mmpl/lib/python3.4/site-packages/seaborn/matrix.py in plot_matrix(self, colorbar_kws, mask, xind, yind, **kws)
    797         self.data2d = self.data2d.iloc[yind, xind]
    798         heatmap(self.data2d, ax=self.ax_heatmap, cbar_ax=self.cax,
--> 799                 cbar_kws=colorbar_kws, mask=mask, **kws)
    800         self.ax_heatmap.yaxis.set_ticks_position('right')
    801         self.ax_heatmap.yaxis.set_label_position('right')

TypeError: heatmap() got multiple values for keyword argument 'ax'

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
mwaskomcommented, Jan 12, 2015

Assuming you mean label the x and y axes, there’s a few options. If you pass a DataFrame with names for the index and columns, those names will be used automatically. Alternatively, the clustermap function returns an object with references to the constituent axes:

g = sns.clustermap(...)
g.ax_heatmap.set_xlabel(...)
1reaction
mwaskomcommented, Apr 17, 2017

No. A clustermap comprises multiple axes that have to be organized in a certain way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to provide axis for seaborn clustermap - Stack Overflow
Thus I was wondering how to correctly pass the axis argument to the clustermap function? Below is a minimal example to reproduce the...
Read more >
seaborn.clustermap — seaborn 0.12.1 documentation - PyData |
LineCollection that is used to plot the lines of the dendrogram tree. kwargsother keyword arguments. All other keyword arguments are passed to heatmap()...
Read more >
Simon Willison - Datasette documentation
An open source multi-tool for exploring and publishing data. Datasette is a tool for exploring and publishing data.
Read more >
seaborn - Bountysource
With some dataframes we encounter strange behaviours of the clustermap, where a dendrogram on one axis does not align with the heat map...
Read more >
scVI Documentation
n_epochs: Number of epochs (passes through the entire dataset) to train the ... of training: blue for training error and orange for testing....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found