【发布时间】:2021-09-09 10:06:34
【问题描述】:
我在 python 2.7 中创建了一些非常漂亮的图。
现在看来,LogNorm 不再起作用了。
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
fig = plt.figure()
ax = fig.add_subplot(111)
# creating logspaced values for colorbar
x = np.logspace(-8,-3,6)
yarr = np.vstack((x,))
print(yarr)
# check if yarr is really logspaced
ax.plot(yarr, [1e1]*len(yarr), 'w.-')
# fill box with colorbar - this does not work anymore
ax.imshow(yarr, extent=(1e-8, 1e-3, 1, 1e4), norm=LogNorm(vmin=1e-8, vmax=1e-3))
ax.set_xscale("log")
ax.set_yscale("log")
立即输出
提前致谢。
【问题讨论】:
标签: python python-3.x matplotlib