回答編集履歴
1
あ
answer
CHANGED
@@ -25,4 +25,24 @@
|
|
25
25
|
import matplotlib
|
26
26
|
matplotlib.use('TkAgg')
|
27
27
|
# import matplotlib.pyplot as plt の前に実行してください。
|
28
|
+
```
|
29
|
+
|
30
|
+
## 設定ファイルを使う場合の方法
|
31
|
+
|
32
|
+
初期状態では、<モジュールのパス>/mpl-data/matplotlibrc から読み込まれているので、これを ~/.config/matplotlib/matplotlibrc にコピーする必要があります。
|
33
|
+
|
34
|
+
設定コピー用スクリプト
|
35
|
+
```python
|
36
|
+
import os
|
37
|
+
import shutil
|
38
|
+
|
39
|
+
import matplotlib as mpl
|
40
|
+
|
41
|
+
mpl_dirpath = os.path.dirname(mpl.__file__)
|
42
|
+
# デフォルトの設定ファイルのパス
|
43
|
+
default_config_path = os.path.join(mpl_dirpath, 'mpl-data', 'matplotlibrc')
|
44
|
+
# カスタム設定ファイルのパス
|
45
|
+
custom_config_path = os.path.join(mpl.get_configdir(), 'matplotlibrc')
|
46
|
+
|
47
|
+
shutil.copyfile(default_config_path, custom_config_path)
|
28
48
|
```
|