myplotlib 1.7.0__py3-none-any.whl

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.
Files changed (52) hide show
  1. myplotlib/__init__.py +79 -0
  2. myplotlib/assets/classic.dark.mplstyle +69 -0
  3. myplotlib/assets/classic.light.mplstyle +60 -0
  4. myplotlib/assets/colormaps/bipolar.csv +1023 -0
  5. myplotlib/assets/colormaps/colt.csv +1024 -0
  6. myplotlib/assets/colormaps/fire.csv +256 -0
  7. myplotlib/assets/colormaps/idl.csv +256 -0
  8. myplotlib/assets/colormaps/sunrise.csv +512 -0
  9. myplotlib/assets/colormaps/thermal.csv +512 -0
  10. myplotlib/assets/colormaps/vanilla.csv +512 -0
  11. myplotlib/assets/fancy.dark.mplstyle +43 -0
  12. myplotlib/assets/fancy.light.mplstyle +32 -0
  13. myplotlib/assets/fonts/AppleChancery.ttf +0 -0
  14. myplotlib/assets/fonts/EBGaramond/EBGaramond-Bold.ttf +0 -0
  15. myplotlib/assets/fonts/EBGaramond/EBGaramond-BoldItalic.ttf +0 -0
  16. myplotlib/assets/fonts/EBGaramond/EBGaramond-ExtraBold.ttf +0 -0
  17. myplotlib/assets/fonts/EBGaramond/EBGaramond-ExtraBoldItalic.ttf +0 -0
  18. myplotlib/assets/fonts/EBGaramond/EBGaramond-Italic.ttf +0 -0
  19. myplotlib/assets/fonts/EBGaramond/EBGaramond-Medium.ttf +0 -0
  20. myplotlib/assets/fonts/EBGaramond/EBGaramond-MediumItalic.ttf +0 -0
  21. myplotlib/assets/fonts/EBGaramond/EBGaramond-Regular.ttf +0 -0
  22. myplotlib/assets/fonts/EBGaramond/EBGaramond-SemiBold.ttf +0 -0
  23. myplotlib/assets/fonts/EBGaramond/EBGaramond-SemiBoldItalic.ttf +0 -0
  24. myplotlib/assets/fonts/Hershey/AVHersheyComplexHeavy.ttf +0 -0
  25. myplotlib/assets/fonts/Hershey/AVHersheyComplexHeavyItalic.ttf +0 -0
  26. myplotlib/assets/fonts/Hershey/AVHersheyComplexLight.ttf +0 -0
  27. myplotlib/assets/fonts/Hershey/AVHersheyComplexLightItalic.ttf +0 -0
  28. myplotlib/assets/fonts/Hershey/AVHersheyComplexMedium.ttf +0 -0
  29. myplotlib/assets/fonts/Hershey/AVHersheyComplexMediumItalic.ttf +0 -0
  30. myplotlib/assets/fonts/Hershey/AVHersheyDuplexHeavy.ttf +0 -0
  31. myplotlib/assets/fonts/Hershey/AVHersheyDuplexHeavyItalic.ttf +0 -0
  32. myplotlib/assets/fonts/Hershey/AVHersheyDuplexLight.ttf +0 -0
  33. myplotlib/assets/fonts/Hershey/AVHersheyDuplexLightItalic.ttf +0 -0
  34. myplotlib/assets/fonts/Hershey/AVHersheyDuplexMedium.ttf +0 -0
  35. myplotlib/assets/fonts/Hershey/AVHersheyDuplexMediumItalic.ttf +0 -0
  36. myplotlib/assets/fonts/Hershey/AVHersheySimplexHeavy.ttf +0 -0
  37. myplotlib/assets/fonts/Hershey/AVHersheySimplexHeavyItalic.ttf +0 -0
  38. myplotlib/assets/fonts/Hershey/AVHersheySimplexLight.ttf +0 -0
  39. myplotlib/assets/fonts/Hershey/AVHersheySimplexLightItalic.ttf +0 -0
  40. myplotlib/assets/fonts/Hershey/AVHersheySimplexMedium.ttf +0 -0
  41. myplotlib/assets/fonts/Hershey/AVHersheySimplexMediumItalic.ttf +0 -0
  42. myplotlib/assets/latex.mplstyle +2 -0
  43. myplotlib/assets/mono.dark.mplstyle +21 -0
  44. myplotlib/assets/mono.light.mplstyle +11 -0
  45. myplotlib/plots.py +658 -0
  46. myplotlib/tests.py +246 -0
  47. myplotlib/tools/__init__.py +0 -0
  48. myplotlib/tools/lic.py +99 -0
  49. myplotlib-1.7.0.dist-info/METADATA +137 -0
  50. myplotlib-1.7.0.dist-info/RECORD +52 -0
  51. myplotlib-1.7.0.dist-info/WHEEL +4 -0
  52. myplotlib-1.7.0.dist-info/licenses/LICENSE +28 -0
myplotlib/__init__.py ADDED
@@ -0,0 +1,79 @@
1
+ __version__ = "1.7.0"
2
+
3
+
4
+ import os
5
+ import warnings
6
+ from pathlib import Path
7
+ import matplotlib.pyplot as plt
8
+ from matplotlib import font_manager, rc_params_from_file
9
+
10
+ import myplotlib
11
+
12
+
13
+ def __RGBToPyCmap(rgbdata):
14
+ import numpy as np
15
+
16
+ nsteps = rgbdata.shape[0]
17
+ stepaxis = np.linspace(0, 1, nsteps)
18
+ rdata = []
19
+ gdata = []
20
+ bdata = []
21
+ for istep in range(nsteps):
22
+ r = rgbdata[istep, 0]
23
+ g = rgbdata[istep, 1]
24
+ b = rgbdata[istep, 2]
25
+ rdata.append((stepaxis[istep], r, r))
26
+ gdata.append((stepaxis[istep], g, g))
27
+ bdata.append((stepaxis[istep], b, b))
28
+ mpl_data = {"red": rdata, "green": gdata, "blue": bdata}
29
+ return mpl_data
30
+
31
+
32
+ CUSTOM_CMAPS = []
33
+
34
+
35
+ def __InstallCmapFromCSV(csv):
36
+ global CUSTOM_CMAPS
37
+ import os
38
+ import numpy as np
39
+ import matplotlib as mpl
40
+
41
+ cmap = os.path.splitext(os.path.basename(csv))[0]
42
+ cmap_data = np.loadtxt(csv, delimiter=",")
43
+ if cmap not in mpl.colormaps.keys():
44
+ CUSTOM_CMAPS.append(cmap)
45
+ mpl_data = __RGBToPyCmap(cmap_data)
46
+ mpl.colormaps.register(
47
+ cmap=mpl.colors.LinearSegmentedColormap(cmap, mpl_data, cmap_data.shape[0])
48
+ )
49
+ cmap = f"{cmap}_r"
50
+ if cmap not in mpl.colormaps.keys():
51
+ mpl_data_r = __RGBToPyCmap(cmap_data[::-1, :])
52
+ mpl.colormaps.register(
53
+ cmap=mpl.colors.LinearSegmentedColormap(
54
+ cmap, mpl_data_r, cmap_data.shape[0]
55
+ )
56
+ )
57
+
58
+
59
+ myplotlib_path = myplotlib.__path__[0]
60
+ styles_path = os.path.join(myplotlib_path, "assets")
61
+
62
+ for path in Path(styles_path).rglob("*.mplstyle"):
63
+ with warnings.catch_warnings(record=True):
64
+ plt.style.library[path.stem] = rc_params_from_file(
65
+ path, use_default_template=False
66
+ )
67
+ plt.style.available[:] = sorted(
68
+ name for name in plt.style.library if not name.startswith("_")
69
+ )
70
+
71
+ CMAP_DIR = os.path.join(myplotlib_path, "assets/colormaps")
72
+ CMAPS = os.listdir(CMAP_DIR)
73
+ for cmap in CMAPS:
74
+ cmapname = os.path.join(CMAP_DIR, cmap)
75
+ __InstallCmapFromCSV(cmapname)
76
+ FONT_DIR = os.path.join(myplotlib_path, "assets/fonts")
77
+ font_files = font_manager.findSystemFonts(fontpaths=[FONT_DIR])
78
+ for font_file in font_files:
79
+ font_manager.fontManager.addfont(font_file)
@@ -0,0 +1,69 @@
1
+ axes.prop_cycle: cycler("color", ["FFFFFF", "FF5555", "5555FF", "55FF55", "FF55FF", "55FFFF", "FFFF55", "AAAAAA"])
2
+ figure.dpi: 150
3
+
4
+ # Set x axis
5
+ xtick.direction: in
6
+ xtick.major.size: 6.0
7
+ # xtick.major.width: 1.5
8
+ xtick.major.pad: 5
9
+ xtick.minor.size: 4
10
+ xtick.minor.visible: True
11
+ xtick.top: True
12
+
13
+ # Set y axis
14
+ ytick.direction: in
15
+ ytick.major.size: 6.0
16
+ # ytick.major.width: 1.5
17
+ ytick.major.pad: 5
18
+ # ytick.minor.size: 4
19
+ ytick.minor.visible: True
20
+ ytick.right: True
21
+
22
+ # Remove legend frame
23
+ legend.frameon: False
24
+
25
+ # Always save as 'tight'
26
+ savefig.bbox: tight
27
+ savefig.pad_inches: 0.05
28
+
29
+ #axes.labelweight : normal
30
+ axes.labelsize: 16
31
+
32
+ grid.alpha: 0.2
33
+
34
+ # tex
35
+ text.usetex: False
36
+
37
+ # fonts
38
+ font.weight: 500
39
+ font.size: 16
40
+
41
+ font.serif: AVHershey Complex
42
+ font.sans-serif: AVHershey Duplex
43
+ font.monospace: AVHershey Complex
44
+
45
+ font.family: serif
46
+
47
+ mathtext.fontset: custom
48
+ mathtext.default: it
49
+ mathtext.rm: AVHershey Complex:medium
50
+ mathtext.it: AVHershey Complex:medium:italic
51
+ mathtext.bf: AVHershey Complex:heavy
52
+ mathtext.sf: AVHershey Duplex:medium
53
+ mathtext.tt: AVHershey Complex:light
54
+
55
+ mathtext.fallback: None
56
+
57
+ axes.formatter.use_mathtext: True
58
+
59
+ ps.fonttype: 42
60
+ pdf.fonttype: 42
61
+
62
+ figure.facecolor: 0d1117
63
+ axes.facecolor: none
64
+ axes.edgecolor: white
65
+ axes.labelcolor: white
66
+ xtick.color: white
67
+ ytick.color: white
68
+ patch.edgecolor: white
69
+ text.color: white
@@ -0,0 +1,60 @@
1
+ axes.prop_cycle: cycler("color", ["000000", "AA0000", "0000AA", "00AA00", "AA00AA", "00AAAA", "AA5500", "AAAAAA"])
2
+ figure.dpi: 150
3
+
4
+ # Set x axis
5
+ xtick.direction: in
6
+ xtick.major.size: 6.0
7
+ # xtick.major.width: 1.5
8
+ xtick.major.pad: 5
9
+ xtick.minor.size: 4
10
+ xtick.minor.visible: True
11
+ xtick.top: True
12
+
13
+ # Set y axis
14
+ ytick.direction: in
15
+ ytick.major.size: 6.0
16
+ # ytick.major.width: 1.5
17
+ ytick.major.pad: 5
18
+ # ytick.minor.size: 4
19
+ ytick.minor.visible: True
20
+ ytick.right: True
21
+
22
+ # Remove legend frame
23
+ legend.frameon: False
24
+
25
+ # Always save as 'tight'
26
+ savefig.bbox: tight
27
+ savefig.pad_inches: 0.05
28
+
29
+ #axes.labelweight : normal
30
+ axes.labelsize: 14
31
+
32
+ grid.alpha: 0.2
33
+
34
+ # tex
35
+ text.usetex: False
36
+
37
+ # fonts
38
+ font.weight: 500
39
+ font.size: 16
40
+
41
+ font.serif: AVHershey Complex
42
+ font.sans-serif: AVHershey Duplex
43
+ font.monospace: AVHershey Complex
44
+
45
+ font.family: serif
46
+
47
+ mathtext.fontset: custom
48
+ mathtext.default: it
49
+ mathtext.rm: AVHershey Complex:medium
50
+ mathtext.it: AVHershey Complex:medium:italic
51
+ mathtext.bf: AVHershey Complex:heavy
52
+ mathtext.sf: AVHershey Duplex:medium
53
+ mathtext.tt: AVHershey Complex:light
54
+
55
+ mathtext.fallback: None
56
+
57
+ axes.formatter.use_mathtext: True
58
+
59
+ ps.fonttype: 42
60
+ pdf.fonttype: 42