見出し画像

Python matplotlibのグラフの種類

Pythonではmatplotlibを使い、簡単にグラフを描くことができます。この中でスタイルを上手く設定することで、グラフの印象を変えることができます。そこで、このグラフのスタイルの一覧をるプログラムを作成しました。

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.style
x = np.arange(0.0, 15.0, 0.1)
y1 = np.sin(x)
y2 = np.cos(x)
mystyle=matplotlib.style.available
for i , v in enumerate(mystyle):
   print(i,v)
   matplotlib.style.use(mystyle[i])
   fig, ax = plt.subplots(figsize=(6, 4))
   ax.plot(x, y1, label='sin')
   ax.plot(x, y2, label='cos')
   ax.legend()
   fig.suptitle(mystyle[i])
   plt.show()

次の通り、種類のスタイルがあることがわかりました。

0 Solarize_Light2

画像1

1 _classic_test_patch

画像2

2 bmh

画像3

3 classic

画像4

4 dark_background

画像5

5 fast

画像6

6 fivethirtyeight

画像7

7 ggplot

画像8

8 grayscale

画像9

9 seaborn

画像10

10 seaborn-bright

画像11

11 seaborn-colorblind

画像12

12 seaborn-dark

画像13

13 seaborn-dark-palette

画像14

14 seaborn-darkgrid

画像15

15 seaborn-deep

画像16

16 seaborn-muted

画像17

17 seaborn-notebook

画像18

18 seaborn-paper

画像19

19 seaborn-pastel

画像20

20 seaborn-poster

画像21

21 seaborn-talk

画像22

22 seaborn-ticks

画像23

23 seaborn-white

画像24

24 seaborn-whitegrid

画像25

25 tableau-colorblind10

画像26

全部で26種類もあります。個人的には最後の25 tableau-colorblind10がしゃれているように感じます。

この記事が気に入ったらサポートをしてみませんか?