Skip to content

Instantly share code, notes, and snippets.

@andrewgiessel
Last active December 27, 2015 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewgiessel/7340672 to your computer and use it in GitHub Desktop.
Save andrewgiessel/7340672 to your computer and use it in GitHub Desktop.
Matplotlib Alpha colormaps
# setup colormaps with alpha backgrounds
imshow(np.random.random((10,10)), cmap='Reds')
imshow(np.random.random((10,10)), cmap='Blues')
close('all')
import copy
red_alpha = copy.copy(mpl.cm.Reds)
blue_alpha = copy.copy(mpl.cm.Blues)
red_alpha._init()
blue_alpha._init()
red_alpha._lut[0,3] = 0
blue_alpha._lut[0,3] = 0
# for jet
import copy
plt.imshow(np.random.random((10,10)), cmap='jet')
plt.close('all')
jet_alpha = copy.copy(mpl.cm.jet)
jet_alpha._init()
jet_alpha._lut[0,3] = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment