在imshow :: matplotlib中记录x-scale

时间:2013-12-30 10:40:48

标签: python matplotlib plot

我有一张看起来像这样的表

enter image description here

我将突出显示的部分作为矩阵,我想要imshow。我希望绘制对数的x刻度,通过查看最上面一行中的参数值可以理解。怎么做是matplotlib?

1 个答案:

答案 0 :(得分:10)

您想使用pcolor,而不是imshow。这是一个例子:

import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
Z = np.random.random(size=(7,7))
x = 10.0 ** np.arange(-2, 5)
y = 10.0 ** np.arange(-4, 3)
ax.set_yscale('log')
ax.set_xscale('log')
ax.pcolor(x, y, Z)

哪位给我:

log pcolor