擅长:python、mysql、java
<p>是的!创建树状图后,可以获取当前图形并进行修改。</p>
<pre><code>dendrogram(
Z,
leaf_rotation = 90., # rotates the x axis labels
leaf_font_size = 10., # font size for the x axis labels)
labels = y # list of labels to include
)
ax = plt.gca()
x_lables = ax.get_xmajorticklabels()
for x in x_labels:
x.set_color(colorDict[x.get_text()])
</code></pre>
<p>希望这有帮助!</p>