EasyPlotLib 0.0.8__tar.gz → 0.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/EasyPlotLib/__init__.py +17 -4
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/EasyPlotLib.egg-info/PKG-INFO +1 -1
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/PKG-INFO +1 -1
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/EasyPlotLib/cartopy_helper.py +0 -0
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/EasyPlotLib/figsizes_set.py +0 -0
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/EasyPlotLib/styles/nature.mplstyle +0 -0
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/EasyPlotLib.egg-info/SOURCES.txt +0 -0
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/EasyPlotLib.egg-info/dependency_links.txt +0 -0
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/EasyPlotLib.egg-info/top_level.txt +0 -0
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/README.md +0 -0
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/setup.cfg +0 -0
- {easyplotlib-0.0.8 → easyplotlib-0.0.9}/setup.py +0 -0
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
import os
|
|
2
|
+
|
|
3
|
+
import matplotlib as mpl
|
|
2
4
|
import matplotlib.font_manager as fm
|
|
3
5
|
import matplotlib.pyplot as plt
|
|
4
6
|
|
|
7
|
+
import EasyPlotLib
|
|
8
|
+
|
|
5
9
|
from .cartopy_helper import cartopy_plot_tickmarks
|
|
6
10
|
from .figsizes_set import figsizes, subplot_labels
|
|
7
|
-
import EasyPlotLib
|
|
8
11
|
|
|
9
12
|
# register the bundled stylesheets in the matplotlib style library
|
|
10
13
|
EasyPlotLib_path = EasyPlotLib.__path__[0]
|
|
11
14
|
font_dir = os.path.join(EasyPlotLib_path, "fonts")
|
|
12
15
|
styles_path = os.path.join(EasyPlotLib_path, "styles")
|
|
13
16
|
|
|
14
|
-
# add fonts
|
|
15
17
|
font_files = fm.findSystemFonts(fontpaths=[font_dir])
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
font_files_set = set(font_files)
|
|
19
|
+
|
|
20
|
+
# 检查是否需要更新缓存
|
|
21
|
+
existing_fonts = {font.fname for font in fm.fontManager.ttflist}
|
|
22
|
+
if not existing_fonts >= font_files_set:
|
|
23
|
+
for font_file in font_files:
|
|
24
|
+
fm.fontManager.addfont(font_file)
|
|
25
|
+
|
|
26
|
+
# 仅当添加了新字体时更新缓存
|
|
27
|
+
cache = os.path.join(
|
|
28
|
+
mpl.get_cachedir(), f"fontlist-v{fm.FontManager.__version__}.json"
|
|
29
|
+
)
|
|
30
|
+
fm.json_dump(fm.fontManager, cache)
|
|
18
31
|
|
|
19
32
|
# Reads styles in /styles folder and all subfolders
|
|
20
33
|
stylesheets = {} # plt.style.library is a dictionary
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|