nano_exit

基礎的なことこそ、簡単な例が必要だと思うのです。

matplotlibの等高線プロットでCDのジャケットを作る

等高線プロットを練習してたら何かカッコイイのが出来たので、CDジャケット風にしてみた。
f:id:koideforest:20171115232319p:plain

import numpy as np
import matplotlib.pyplot as plt

N = 5

x = y = np.arange( N )
X, Y = np.meshgrid( x, y )

z = np.random.rand( N * N )
Z = z.reshape( N, N )

plt.figure( figsize = ( 4.72, 4.72 ) )
plt.tick_params( left='off', right='off', bottom='off', top='off' \
                 labelleft='off', labelright='off', labelbottom='off', labeltop='off' )
plt.contour( X, Y, Z )
plt.viridis()

plt.show()

CDジャケットのサイズは約4.72平方インチらしい。
敢えて小さめにして枠を残して印刷してもカッコイイかも。