擅长:python、mysql、java
<p>您可以使用<code>extent</code>kwarg将imshow绘图放在正确的位置。另外,如果您也这样做了,那么您应该能够让matplotlib自动处理轴记号。在</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
x = np.random.rand(2,3)
plt.imshow(x, interpolation='nearest', extent=[0,3,0,2])
</code></pre>
<p><img src="https://i.stack.imgur.com/CJTfg.png" alt="enter image description here"/></p>
^{pr2}$
<p><img src="https://i.stack.imgur.com/yBJI5.png" alt="enter image description here"/></p>