Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

clustermap subplots

import pandas as pd
import seaborn as sns

# initiliaze a dataframe with index and column names
idf = pd.DataFrame.from_items([('A', [1, 2, 3]), ('B', [4, 5, 6]), ('C', [10, 20, 30]), ('D', [14, 15, 16])], orient='index', columns=['x', 'y', 'z'])

# Plot the clustermap which will be a figure by itself
cax = sns.clustermap(idf, col_cluster=False, row_cluster=True)

# Get the column dendrogram axis
cax_col_dend_ax = cax.ax_col_dendrogram.axes

# Plot the boxplot on the column dendrogram axis
# I still need to figure out how to show the axis for this boxplot
idf.plot(kind='box', ax=cax_col_dend_ax)

# Show the plot
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: django command to fetch all columns of a table 
Python :: how to read file again in python 
Python :: pyqt5.direct connection 
Python :: run python script in synology sample 
Python :: signup generic 
Python :: python dash bootstrap buttons with icons 
Python :: draw a marker in basemap python 
Python :: integrate label into listbox tkinter 
Python :: forward fill pandas ffill 
Python :: torch.cuda.randn 
Python :: when excel is loaded into python, numeric datatype changes to float 
Python :: how to do welcome in bubble letters in python 
Python :: numpy convolution stride tricks 
Python :: validate delete inline formset django 
Python :: main() invalid syntax 
Python :: print("python is good") 
Python :: Desviacion estandard en pandas 
Python :: convert step in stl file python OCC.core 
Python :: Center labels matplotlib histogram 
Python :: what does math.acos do in python 
Python :: encrypt 
Python :: pip package dynamic setup.py example 
Python :: reloading a django view function withouit resetting context data 
Python :: different accuracy score for knn 
Python :: how to rub softwares using python 
Python :: words repeating in word cloud python 
Python :: how to break out of while loop when the user hit ctrl + d python 
Python :: auto indent python code 
Python :: biopython parse fasta 
Python :: tuples of unique rows pandas 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =