LoginSignup
79
75

More than 5 years have passed since last update.

matplotlibで色をグラデーション的に選択

Last updated at Posted at 2016-11-07
  • いちいち変えるの面倒だけどパラメータが多い
  • グラデーション的に変えたい
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
x =np.linspace(0,2*np.pi,100)
for i in range(30):   
    plt.plot(x,i*np.sin(x),color=cm.hsv(i/30.0))
plt.xlim(0,2*np.pi)
plt.savefig("cm.png")
plt.show()

色の参考にcmリスト

  • さっきのcm.hogeの所を色々変えてみたものを図示
  • [0,1]のグラデーションになっていて,一番平らなのが0,盛り上がっているのが1

可視化の参考にどうぞ

王道カラフル系

  • hsv

hsv.png

  • jet

jet.png

  • spectral

spectral.png

単色濃淡(っぽい)

  • bone

bone.png

  • gray

gray.png

  • pink

pink.png

  • copper

copper.png

複数色グラデーション系

  • cool

cool.png

  • hot

hot.png

季節の色たち

  • spring

spring.png

  • summer

summer.png

  • autumn

autumn.png

  • winter

winter.png

グラデーションにならない系

  • flag

flag.png

  • prism

prism.png

79
75
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
79
75