Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. # Get a list of the colormaps in matplotlib. Ignore the ones that end with
  5. # '_r' because these are simply reversed versions of ones that don't end
  6. # with '_r'
  7. maps = sorted(m for m in plt.cm.datad if not m.endswith("_r"))
  8.  
  9. for i,m in enumerate(maps):
  10.  
  11. print "exporting colourmap: " + m
  12.  
  13. f = open(m,'w')
  14.  
  15. cmap=plt.get_cmap(m)
  16. for i in range(256):
  17. val = tuple(int(x*255) for x in cmap(i))
  18. f.write(str(val[0]) + '\t' + str(val[1]) + '\t' + str(val[2]) + '\n')
  19.  
  20. f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement