我的色条有问题。它似乎在颜色条下面输出了一大堆重叠的记号,我不知道为什么。我也不知道如何让色条刻度以科学的符号表示,而不是它们现在是怎样的。这是我的密码
from matplotlib.colors import LogNorm
from matplotlib.ticker import LogFormatter
import matplotlib.colors as mc
import matplotlib.cm as cm
from mpl_toolkits.axes_grid1 import AxesGrid
import matplotlib.pyplot as plt
import numpy as np
from plotbin.sauron_colormap import register_sauron_colormap
register_sauron_colormap()
fig = plt.figure(figsize=(15,5)) #This determines the size of the figure
grid = AxesGrid(fig, 111, nrows_ncols=(1, 1), axes_pad=0.0, share_all=True, \
label_mode="L", cbar_location="right", cbar_mode="each", cbar_size='6%')
A = np.random.rand(58,58)
image = grid[0].imshow(np.rot90(A), cmap='sauron', interpolation=None, norm = LogNorm())
grid.cbar_axes[0].colorbar(image)
以及输出
我该如何解决这个问题
这看起来像是
LogNorm()
由于未知原因与AxesGrid
一起引入的错误。但是,由于您可能也看到了弃用警告:您还可以更改将颜色条打印到指定空间的方法
样本输出:![enter image description here](https://i.stack.imgur.com/6ta7P.png)
相关问题 更多 >
编程相关推荐