Reputation: 22041
How can I change the first color in a listed colormap in matplotlib to gray? I created the colormap as follows:
import matplotlib.pyplot as plt
plt.get_cmap('viridis_r')
Upvotes: 0
Views: 268
Reputation: 4548
Sorry I haven't tested this, but does this work?
>>> col_map = plt.get_cmap('viridis_r')
>>> col_map.__dict__['colors'].insert(0,[0.5,0.5,0.5])
Upvotes: 1