ヒートマップのようなものを作るとき用に調べた。 [0, 1]の範囲の値を青ー赤のカラーに変換 http://qiita.com/krsak/items/94fad1d3fffa997cb651 PNGの書き出し http://danpansa.blog.jp/archives/12901916.html #!/usr/bin/env python import math import Image def colorscale(v): t = math.cos(4 * math.pi * v) c = int(((-t / 2) + 0.5) * 255) if v >= 1.0: return (255, 0, 0) elif v >= 0.75: return (255, c, 0) elif v >= 0.5: return (c, 255, 0) elif v >= 0.25: re