我想绘制一个更大字体大小的树形图,但scipy documentation中的命令不起作用。标签的大小与leaf_font_size = 8相同。 / 24. /无。也许我对这个问题的使用并不了解,或者你知道一些技巧可以让它发挥作用。如果你能帮助我,我将不胜感激。 我的代码:
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.cluster import hierarchy as hier
import cPickle
from abclib import *
np.set_printoptions(precision=5, suppress=True)
df = pd.read_excel('rmsd_a2a_matrix.xlsx')
Z = hier.linkage(df, 'ward')
ABC = cPickle.load(open('ABC.pkl', 'rb'))
labelL = []
for i in list(df.columns.values):
for abc in ABC.values():
if i == abc.pdb.pdbid:
labelL.append('%s (%s)' % (i, abc.name))
fig = plt.figure(figsize=(10, 20))
plt.title('Dendrogram')
ax = fig.add_subplot(1,1,1)
ax.set_ylabel('pdb id and name')
ax.set_xlabel('distance')
ax.yaxis.set_label_position("right")
den = hier.dendrogram(
Z,
#leaf_rotation=30., # rotates the x axis labels - I don't use this
leaf_font_size=24., # font size for the x axis labels
labels = labelL,
orientation = 'right'
)
plt.savefig('dendogram.png', bbox_inches='tight', transparent = True, dpi = 300)
plt.close()