maxplotlibx 0.1.2__tar.gz → 0.1.4__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.
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/PKG-INFO +3 -3
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/pyproject.toml +4 -4
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/backends/matplotlib/utils.py +22 -4
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/canvas/canvas.py +522 -180
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/colors/colors.py +11 -10
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/linestyle/linestyle.py +11 -10
- maxplotlibx-0.1.4/src/maxplotlib/subfigure/line_plot.py +659 -0
- maxplotlibx-0.1.4/src/maxplotlib/utils/options.py +3 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlibx.egg-info/PKG-INFO +3 -3
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlibx.egg-info/requires.txt +2 -2
- maxplotlibx-0.1.2/src/maxplotlib/subfigure/line_plot.py +0 -313
- maxplotlibx-0.1.2/src/maxplotlib/utils/options.py +0 -3
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/LICENSE +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/README.md +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/setup.cfg +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/__init__.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/backends/plotly/__init__.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/backends/plotly/utils.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/canvas/__init__.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/colors/__init__.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/linestyle/__init__.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/objects/__init__.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/objects/node.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/objects/path.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/subfigure/__init__.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/subfigure/subfigure.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/tests/test_canvas.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/tests/test_imports.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/tests/test_plot.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlib/utils/__init__.py +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlibx.egg-info/SOURCES.txt +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlibx.egg-info/dependency_links.txt +0 -0
- {maxplotlibx-0.1.2 → maxplotlibx-0.1.4}/src/maxplotlibx.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: maxplotlibx
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: A reproducible plotting module with various backends and export options.
|
|
5
5
|
Author: Max
|
|
6
6
|
Project-URL: Source, https://github.com/max-models/maxplotlib
|
|
@@ -12,7 +12,7 @@ License-File: LICENSE
|
|
|
12
12
|
Requires-Dist: matplotlib
|
|
13
13
|
Requires-Dist: pint
|
|
14
14
|
Requires-Dist: plotly
|
|
15
|
-
Requires-Dist:
|
|
15
|
+
Requires-Dist: tikzfigure[vis]>=0.2.0
|
|
16
16
|
Provides-Extra: test
|
|
17
17
|
Requires-Dist: pytest; extra == "test"
|
|
18
18
|
Requires-Dist: coverage; extra == "test"
|
|
@@ -26,7 +26,7 @@ Requires-Dist: nbconvert; extra == "docs"
|
|
|
26
26
|
Provides-Extra: dev
|
|
27
27
|
Requires-Dist: maxplotlibx[docs,test]; extra == "dev"
|
|
28
28
|
Requires-Dist: ruff; extra == "dev"
|
|
29
|
-
Requires-Dist: black; extra == "dev"
|
|
29
|
+
Requires-Dist: black[jupyter]; extra == "dev"
|
|
30
30
|
Requires-Dist: isort; extra == "dev"
|
|
31
31
|
Requires-Dist: jupyterlab; extra == "dev"
|
|
32
32
|
Requires-Dist: nbstripout; extra == "dev"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "maxplotlibx"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.4"
|
|
8
8
|
description = "A reproducible plotting module with various backends and export options."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -18,7 +18,7 @@ dependencies = [
|
|
|
18
18
|
"matplotlib",
|
|
19
19
|
"pint",
|
|
20
20
|
"plotly",
|
|
21
|
-
"
|
|
21
|
+
"tikzfigure[vis]>=0.2.0",
|
|
22
22
|
]
|
|
23
23
|
[project.optional-dependencies]
|
|
24
24
|
test = [
|
|
@@ -36,7 +36,7 @@ docs = [
|
|
|
36
36
|
dev = [
|
|
37
37
|
"maxplotlibx[test,docs]",
|
|
38
38
|
"ruff",
|
|
39
|
-
"black",
|
|
39
|
+
"black[jupyter]",
|
|
40
40
|
"isort",
|
|
41
41
|
"jupyterlab",
|
|
42
42
|
"nbstripout",
|
|
@@ -56,4 +56,4 @@ line-length = 88
|
|
|
56
56
|
line-length = 88
|
|
57
57
|
|
|
58
58
|
[tool.isort]
|
|
59
|
-
profile = "black"
|
|
59
|
+
profile = "black"
|
|
@@ -56,18 +56,30 @@ def convert_to_inches(length_str):
|
|
|
56
56
|
return quantity.to("inch").magnitude # Convert to inches
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
def _2pt(width, dpi=300):
|
|
59
|
+
def _2pt(width, dpi=300, verbose: bool = False):
|
|
60
|
+
if verbose:
|
|
61
|
+
print(f"Converting width: {width} to points with dpi={dpi}")
|
|
62
|
+
|
|
60
63
|
if isinstance(width, (int, float)):
|
|
61
64
|
return width
|
|
62
65
|
elif isinstance(width, str):
|
|
63
66
|
length_in = convert_to_inches(width)
|
|
64
67
|
length_pt = length_in * dpi
|
|
68
|
+
if verbose:
|
|
69
|
+
print(f"Converted length: {length_in} inches = {length_pt} points")
|
|
65
70
|
return length_pt
|
|
66
71
|
else:
|
|
67
72
|
raise NotImplementedError
|
|
68
73
|
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
# TODO: Use literal types for width and ratio
|
|
76
|
+
def set_size(
|
|
77
|
+
width: str,
|
|
78
|
+
fraction: int | float = 1,
|
|
79
|
+
ratio: str | int | float = "golden",
|
|
80
|
+
dpi=300,
|
|
81
|
+
verbose: bool = False,
|
|
82
|
+
) -> tuple:
|
|
71
83
|
"""
|
|
72
84
|
Sets figure dimensions to avoid scaling in LaTeX.
|
|
73
85
|
"""
|
|
@@ -76,9 +88,11 @@ def set_size(width, fraction=1, ratio="golden", dpi=300):
|
|
|
76
88
|
elif width == "beamer":
|
|
77
89
|
width_pt = 307.28987
|
|
78
90
|
else:
|
|
79
|
-
width_pt = _2pt(width=width, dpi=dpi)
|
|
91
|
+
width_pt = _2pt(width=width, dpi=dpi, verbose=verbose)
|
|
80
92
|
|
|
81
93
|
fig_width_pt = width_pt * fraction
|
|
94
|
+
inches_per_pt = 1 / 72.27
|
|
95
|
+
# fig_width_pt = width_pt * fraction
|
|
82
96
|
# inches_per_pt = 1 / 72.27
|
|
83
97
|
|
|
84
98
|
# Calculate the figure height based on the desired ratio
|
|
@@ -91,7 +105,11 @@ def set_size(width, fraction=1, ratio="golden", dpi=300):
|
|
|
91
105
|
fig_height_pt = fig_width_pt * ratio
|
|
92
106
|
else:
|
|
93
107
|
raise ValueError("Invalid ratio specified.")
|
|
94
|
-
|
|
108
|
+
|
|
109
|
+
# Convert from points to inches for matplotlib
|
|
110
|
+
fig_width_in = fig_width_pt * inches_per_pt
|
|
111
|
+
fig_height_in = fig_height_pt * inches_per_pt
|
|
112
|
+
fig_dim = (fig_width_in, fig_height_in)
|
|
95
113
|
return fig_dim
|
|
96
114
|
|
|
97
115
|
|