【发布时间】:2020-04-12 06:15:21
【问题描述】:
我只修改了this basic example一点点,这样颜色条的脊椎颜色就会改变。 有趣的是,只有蜱的颜色在变化,而脊椎的颜色没有变化。我做错了什么?
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np
fig, ax = plt.subplots()
im = ax.imshow(np.arange(100).reshape((10, 10)))
# create an axes on the right side of ax. The width of cax will be 5%
# of ax and the padding between cax and ax will be fixed at 0.05 inch.
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.05)
colorbar = fig.colorbar(im, cax=cax)
colorbar.ax.tick_params(axis='both', colors='#f9f2d7')
colorbar.ax.spines['bottom'].set_color('#f9f2d7')
colorbar.ax.spines['top'].set_color('#f9f2d7')
colorbar.ax.spines['right'].set_color('#f9f2d7')
colorbar.ax.spines['left'].set_color('#f9f2d7')
fig.canvas.show()
【问题讨论】:
标签: python matplotlib colors colorbar spine