LoginSignup
0
0

More than 3 years have passed since last update.

matplotlibメモ

Last updated at Posted at 2019-07-09
plt.py
import matplotlib.pyplot as plt

#何も描画されていない新しいウィンドウを描画
plt.figure()
#画像を表示
plt.imshow(train_images[0])
#よくわからん
plt.gca().grid(False)
plt.show()
plt.py
import matplotlib.pyplot as plt

#幅と高さを指定
plt.figure(figsize=(10,10))
for i in range(25):
#グリッド上に図を配置(行数、列数、プロット番号)
    plt.subplot(5,5,i+1)
    plt.xticks([])
    plt.yticks([])
    plt.grid(False)
#cmで色を指定
    plt.imshow(train_images[i], cmap=plt.cm.binary)
    plt.xlabel(class_names[train_labels[i]])
plt.show()
plt.py
import matplotlib.pyplot as plt

# "bo" は青いドット
plt.plot(epochs, loss, 'bo', label='Training loss')
# ”b" は青い実線
plt.plot(epochs, val_loss, 'b', label='Validation loss')
plt.title('Training and validation loss')
plt.xlabel('Epochs')
plt.ylabel('Loss')
#凡例の位置を調整する。詳しくは下記のURL
plt.legend()

plt.show()

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