0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

カラーマップ数値化

Posted at

##本の内容

'''
cm_name = 'jet'
cm = plt.get_cmap(cm_name)
print(type(cm))

print(cm.N) # 256
print(cm(0))

for i in range(256):
print(cm(i))

temp_cm = np.array(cm)

X, Y = np.meshgrid(np.linspace(0, 1, 100), np.linspace(0, 1, 100))
z = np.sin(2 * np.pi * X) * np.cos(2 * np.pi * Y)

カラーマップを選択

cmap = plt.get_cmap('jet')

正規化

norm = plt.Normalize(vmin=z.min(), vmax=z.max())

逆マッピング

color_value = cmap(norm(0.7)) # 0.7に対応する色を取得

print(f"色から取り出した値: {norm.inverse(color_value)}")

'''

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?