擅长:python、mysql、java
<p>既然你没有指定matplotlib的限制用法,我建议你使用seaborn库,因为它非常简单,如果你想改变一些奇怪的东西,如果我没有错的话,它是用matplolib构建的。使用seaborn是:</p>
<pre><code>import seaborn as sns
plt.figure(figsize = (10,10)) #This is the size of the image
heatM = sns.heatmap(cov_vals, vmin = -1, vmax = 1,center = 0, cmap = sns.diverging_palette(20, 220, n = 200), square = True, annot = True) #this are the caracteristics of the heatmap
heatM.set_ylim([10,0]) # This is the limit in y axis (number of features)
</code></pre>
<p>这就是结果。小心极限加热装置([10,0])对于x,这需要是您拥有的变量数。你知道吗</p>
<p>希望这有用。你知道吗</p>
<p><a href="https://i.stack.imgur.com/0s5Q1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0s5Q1.png" alt="enter image description here"/></a></p>