回答編集履歴

1

2018/10/02 16:36

投稿

tiitoi
tiitoi

スコア21956

test CHANGED
@@ -53,3 +53,43 @@
53
53
  # import matplotlib.pyplot as plt の前に実行してください。
54
54
 
55
55
  ```
56
+
57
+
58
+
59
+ ## 設定ファイルを使う場合の方法
60
+
61
+
62
+
63
+ 初期状態では、<モジュールのパス>/mpl-data/matplotlibrc から読み込まれているので、これを ~/.config/matplotlib/matplotlibrc にコピーする必要があります。
64
+
65
+
66
+
67
+ 設定コピー用スクリプト
68
+
69
+ ```python
70
+
71
+ import os
72
+
73
+ import shutil
74
+
75
+
76
+
77
+ import matplotlib as mpl
78
+
79
+
80
+
81
+ mpl_dirpath = os.path.dirname(mpl.__file__)
82
+
83
+ # デフォルトの設定ファイルのパス
84
+
85
+ default_config_path = os.path.join(mpl_dirpath, 'mpl-data', 'matplotlibrc')
86
+
87
+ # カスタム設定ファイルのパス
88
+
89
+ custom_config_path = os.path.join(mpl.get_configdir(), 'matplotlibrc')
90
+
91
+
92
+
93
+ shutil.copyfile(default_config_path, custom_config_path)
94
+
95
+ ```