gsplot 0.1.0__tar.gz → 0.1.1__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.
- {gsplot-0.1.0 → gsplot-0.1.1}/PKG-INFO +6 -6
- {gsplot-0.1.0 → gsplot-0.1.1}/README.md +5 -5
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/__init__.py +4 -0
- gsplot-0.1.1/gsplot/figure/axes_inset.py +718 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/style/label.py +12 -8
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/style/legend.py +5 -2
- gsplot-0.1.1/gsplot/version.py +2 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/pyproject.toml +1 -1
- gsplot-0.1.0/gsplot/version.py +0 -2
- {gsplot-0.1.0 → gsplot-0.1.1}/LICENSE +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/base/base.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/base/base_alias_validator.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/color/colormap.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/config/config.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/data/load_file.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/figure/axes.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/figure/axes_base.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/figure/axes_range_base.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/figure/figure_tools.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/figure/show.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/figure/store.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/hello_world/hello_world.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/logger.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/path/path.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/plot/line.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/plot/line_base.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/plot/line_colormap_base.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/plot/line_colormap_dashed.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/plot/line_colormap_solid.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/plot/scatter.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/plot/scatter_colormap.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/style/graph.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/style/legend_colormap.py +0 -0
- {gsplot-0.1.0 → gsplot-0.1.1}/gsplot/style/ticks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gsplot
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: General-scientific plot based on matplotlib
|
|
5
5
|
Author: Giordano Mattoni
|
|
6
6
|
Author-email: mattoni@scphys.kyoto-u.ac.jp
|
|
@@ -37,17 +37,17 @@ Description-Content-Type: text/markdown
|
|
|
37
37
|
<a href="#license" style="text-decoration: none;">License</a>
|
|
38
38
|
</p>
|
|
39
39
|
|
|
40
|
-
Welcome to **gsplot** (
|
|
40
|
+
Welcome to **gsplot** (General-Scientific Plot), a toolkit designed to elevate capabilities of data visualization based on [matplotlib](https://matplotlib.org). This package is specifically tailored for creating high-quality figures aimed at the scientific field.
|
|
41
41
|
|
|
42
42
|
> [!WARNING]
|
|
43
43
|
> This package is _beta_ quality. Expect breaking changes and many bugs 🐛. Please report any issue you encounter 🤝.
|
|
44
44
|
|
|
45
45
|
## ✨ Features
|
|
46
46
|
|
|
47
|
-
- **Better Plot, Less
|
|
48
|
-
- **Compatibility**:
|
|
49
|
-
- **Customization**:
|
|
50
|
-
- **Reproducibility**: Save
|
|
47
|
+
- **Better Plot, Less Effort**: Effortlessly create high-quality figures ⚛️
|
|
48
|
+
- **Compatibility**: Fully compatible with [matplotlib](https://matplotlib.org) 📊
|
|
49
|
+
- **Customization**: Tailor configurations to suit your needs 🎨
|
|
50
|
+
- **Reproducibility**: Save package states for reproducible plots 📦
|
|
51
51
|
|
|
52
52
|
### 📈 Example using gsplot
|
|
53
53
|
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
<a href="#license" style="text-decoration: none;">License</a>
|
|
18
18
|
</p>
|
|
19
19
|
|
|
20
|
-
Welcome to **gsplot** (
|
|
20
|
+
Welcome to **gsplot** (General-Scientific Plot), a toolkit designed to elevate capabilities of data visualization based on [matplotlib](https://matplotlib.org). This package is specifically tailored for creating high-quality figures aimed at the scientific field.
|
|
21
21
|
|
|
22
22
|
> [!WARNING]
|
|
23
23
|
> This package is _beta_ quality. Expect breaking changes and many bugs 🐛. Please report any issue you encounter 🤝.
|
|
24
24
|
|
|
25
25
|
## ✨ Features
|
|
26
26
|
|
|
27
|
-
- **Better Plot, Less
|
|
28
|
-
- **Compatibility**:
|
|
29
|
-
- **Customization**:
|
|
30
|
-
- **Reproducibility**: Save
|
|
27
|
+
- **Better Plot, Less Effort**: Effortlessly create high-quality figures ⚛️
|
|
28
|
+
- **Compatibility**: Fully compatible with [matplotlib](https://matplotlib.org) 📊
|
|
29
|
+
- **Customization**: Tailor configurations to suit your needs 🎨
|
|
30
|
+
- **Reproducibility**: Save package states for reproducible plots 📦
|
|
31
31
|
|
|
32
32
|
### 📈 Example using gsplot
|
|
33
33
|
|
|
@@ -3,6 +3,7 @@ from .config.config import (Config, config_dict, config_entry_option,
|
|
|
3
3
|
config_load, save_metadata)
|
|
4
4
|
from .data.load_file import load_file
|
|
5
5
|
from .figure.axes import axes
|
|
6
|
+
from .figure.axes_inset import axes_inset, axes_inset_padding
|
|
6
7
|
from .figure.figure_tools import get_figure_size
|
|
7
8
|
from .figure.show import show
|
|
8
9
|
from .hello_world.hello_world import hello_world
|
|
@@ -49,6 +50,9 @@ __all__ = [
|
|
|
49
50
|
"load_file",
|
|
50
51
|
# figure/axes.py
|
|
51
52
|
"axes",
|
|
53
|
+
# figure/axes_inset.py
|
|
54
|
+
"axes_inset",
|
|
55
|
+
"axes_inset_padding",
|
|
52
56
|
# figure/figure_tools.py
|
|
53
57
|
"get_figure_size",
|
|
54
58
|
# figure/show.py
|
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
from typing import Any, cast
|
|
2
|
+
|
|
3
|
+
from matplotlib.axes import Axes
|
|
4
|
+
from matplotlib.transforms import BboxBase, Transform, TransformedBbox
|
|
5
|
+
from matplotlib.typing import ColorType
|
|
6
|
+
from mpl_toolkits.axes_grid1.inset_locator import (BboxConnector, BboxPatch,
|
|
7
|
+
inset_axes)
|
|
8
|
+
|
|
9
|
+
from ..base.base import CreateClassParams, ParamsGetter, bind_passed_params
|
|
10
|
+
from ..style.label import Label
|
|
11
|
+
from ..style.ticks import MinorTicks
|
|
12
|
+
|
|
13
|
+
__all__ = ["axes_inset", "axes_inset_padding"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class InsetAxesBase:
|
|
17
|
+
"""
|
|
18
|
+
A utility class for managing inset axes in a Matplotlib figure.
|
|
19
|
+
|
|
20
|
+
This class provides functionality for configuring and customizing inset axes,
|
|
21
|
+
including zooming, labeling, and enabling minor ticks. It also allows for manual
|
|
22
|
+
control of zoom connectors and axis limits.
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
--------------------
|
|
26
|
+
ax : Axes
|
|
27
|
+
The main axis in the figure.
|
|
28
|
+
axins : Axes
|
|
29
|
+
The inset axis in the figure.
|
|
30
|
+
lab_lims : list[Any] | None, optional
|
|
31
|
+
List specifying axis labels and limits for the inset axis.
|
|
32
|
+
Expected format: [x_label, y_label, x_lim_min, x_lim_max, y_lim_min, y_lim_max].
|
|
33
|
+
x_pad : int | float, default=2
|
|
34
|
+
Horizontal padding for axis labels.
|
|
35
|
+
y_pad : int | float, default=2
|
|
36
|
+
Vertical padding for axis labels.
|
|
37
|
+
minor_ticks : bool, default=True
|
|
38
|
+
Whether to enable minor ticks on the inset axis.
|
|
39
|
+
zoom : bool or tuple[tuple[int, int], tuple[int, int]], default=True
|
|
40
|
+
Zoom settings for the inset axis.
|
|
41
|
+
- If True, uses the built-in zoom indication.
|
|
42
|
+
- If a tuple, manually connects the axes with zoom connectors.
|
|
43
|
+
zoom_color : ColorType, default='black'
|
|
44
|
+
Color for the zoom connectors and patches.
|
|
45
|
+
zoom_alpha : int | float, default=0.3
|
|
46
|
+
Transparency for the zoom connectors and patches.
|
|
47
|
+
**kwargs : Any
|
|
48
|
+
Additional keyword arguments for axis label configuration.
|
|
49
|
+
|
|
50
|
+
Notes
|
|
51
|
+
--------------------
|
|
52
|
+
This class is designed for cases where inset axes are needed for enhanced
|
|
53
|
+
visualization. It uses helper classes like `Label` and `MinorTicks` to
|
|
54
|
+
streamline customization.
|
|
55
|
+
|
|
56
|
+
Methods
|
|
57
|
+
--------------------
|
|
58
|
+
manual_inset_zoom():
|
|
59
|
+
Manually connect the main axis to the inset axis with zoom connectors.
|
|
60
|
+
|
|
61
|
+
indicate_inset_zoom():
|
|
62
|
+
Use the built-in Matplotlib method to indicate zoom on the inset axis.
|
|
63
|
+
|
|
64
|
+
inset_zoom():
|
|
65
|
+
Automatically apply zoom connectors based on the `zoom` attribute.
|
|
66
|
+
|
|
67
|
+
set_minor_ticks():
|
|
68
|
+
Enable minor ticks on the inset axis.
|
|
69
|
+
|
|
70
|
+
label():
|
|
71
|
+
Configure and set labels and axis limits for the inset axis.
|
|
72
|
+
|
|
73
|
+
Warnings
|
|
74
|
+
--------------------
|
|
75
|
+
- Ensure that `lab_lims` is provided and correctly formatted when calling `label()`.
|
|
76
|
+
- `zoom` should be a tuple of tuples when using `manual_inset_zoom()`.
|
|
77
|
+
|
|
78
|
+
Examples
|
|
79
|
+
--------------------
|
|
80
|
+
>>> import matplotlib.pyplot as plt
|
|
81
|
+
>>> fig, ax = plt.subplots()
|
|
82
|
+
>>> axins = ax.inset_axes([0.5, 0.5, 0.4, 0.4])
|
|
83
|
+
>>> inset = InsetAxesBase(
|
|
84
|
+
... ax,
|
|
85
|
+
... axins,
|
|
86
|
+
... lab_lims=["X Label", "Y Label", 0, 1, 0, 1],
|
|
87
|
+
... zoom=((1, 2), (3, 4)),
|
|
88
|
+
... )
|
|
89
|
+
>>> inset.set_minor_ticks()
|
|
90
|
+
>>> inset.label()
|
|
91
|
+
>>> inset.inset_zoom()
|
|
92
|
+
>>> plt.show()
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
def __init__(
|
|
96
|
+
self,
|
|
97
|
+
ax,
|
|
98
|
+
axins,
|
|
99
|
+
lab_lims: list[Any] | None = None,
|
|
100
|
+
x_pad: int | float = 2,
|
|
101
|
+
y_pad: int | float = 2,
|
|
102
|
+
minor_ticks: bool = True,
|
|
103
|
+
zoom: bool | tuple[tuple[int, int], tuple[int, int]] = True,
|
|
104
|
+
zoom_color: ColorType = "black",
|
|
105
|
+
zoom_alpha: int | float = 0.3,
|
|
106
|
+
**kwargs,
|
|
107
|
+
) -> None:
|
|
108
|
+
self.ax: Axes = ax
|
|
109
|
+
self.axins: Axes = axins
|
|
110
|
+
self.lab_lims: list[Any] | None = lab_lims
|
|
111
|
+
self.x_pad: int | float = x_pad
|
|
112
|
+
self.y_pad: int | float = y_pad
|
|
113
|
+
self.minor_ticks: bool = minor_ticks
|
|
114
|
+
self.zoom: bool | tuple[tuple[int, int], tuple[int, int]] = zoom
|
|
115
|
+
self.zoom_color: ColorType = zoom_color
|
|
116
|
+
self.zoom_alpha: int | float = zoom_alpha
|
|
117
|
+
self.kwargs: Any = kwargs
|
|
118
|
+
|
|
119
|
+
def manual_inset_zoom(self):
|
|
120
|
+
"""
|
|
121
|
+
Manually connect the main axis to the inset axis with zoom connectors.
|
|
122
|
+
|
|
123
|
+
This method adds connectors and a patch between the main and inset axes
|
|
124
|
+
to visually represent the zoomed-in region.
|
|
125
|
+
|
|
126
|
+
Raises:
|
|
127
|
+
ValueError: If `zoom` is not a tuple of tuples.
|
|
128
|
+
|
|
129
|
+
Notes
|
|
130
|
+
--------------------
|
|
131
|
+
This method is used when manual control over zoom connectors is required.
|
|
132
|
+
"""
|
|
133
|
+
if isinstance(self.zoom, bool):
|
|
134
|
+
raise ValueError("locs_zoom must be a tuple of tuples")
|
|
135
|
+
|
|
136
|
+
loc1a, loc1b = self.zoom[0]
|
|
137
|
+
loc2a, loc2b = self.zoom[1]
|
|
138
|
+
rect = TransformedBbox(self.axins.viewLim, self.ax.transData)
|
|
139
|
+
pp = BboxPatch(
|
|
140
|
+
rect, fill=False, edgecolor=self.zoom_color, alpha=self.zoom_alpha
|
|
141
|
+
)
|
|
142
|
+
self.ax.add_patch(pp)
|
|
143
|
+
p1 = BboxConnector(
|
|
144
|
+
self.axins.bbox,
|
|
145
|
+
rect,
|
|
146
|
+
loc1=loc1b,
|
|
147
|
+
loc2=loc1a,
|
|
148
|
+
color=self.zoom_color,
|
|
149
|
+
alpha=self.zoom_alpha,
|
|
150
|
+
)
|
|
151
|
+
self.axins.add_patch(p1)
|
|
152
|
+
p1.set_clip_on(False)
|
|
153
|
+
p2 = BboxConnector(
|
|
154
|
+
self.axins.bbox,
|
|
155
|
+
rect,
|
|
156
|
+
loc1=loc2b,
|
|
157
|
+
loc2=loc2a,
|
|
158
|
+
color=self.zoom_color,
|
|
159
|
+
alpha=self.zoom_alpha,
|
|
160
|
+
)
|
|
161
|
+
self.axins.add_patch(p2)
|
|
162
|
+
p2.set_clip_on(False)
|
|
163
|
+
|
|
164
|
+
def indicate_inset_zoom(self):
|
|
165
|
+
"""
|
|
166
|
+
Use Matplotlib's built-in method to indicate zoom on the inset axis.
|
|
167
|
+
|
|
168
|
+
This method creates a zoom indication using a rectangular outline between
|
|
169
|
+
the main and inset axes.
|
|
170
|
+
|
|
171
|
+
Notes
|
|
172
|
+
--------------------
|
|
173
|
+
This method is simpler and faster than `manual_inset_zoom` but offers
|
|
174
|
+
less customization.
|
|
175
|
+
"""
|
|
176
|
+
self.ax.indicate_inset_zoom(
|
|
177
|
+
self.axins, edgecolor=self.zoom_color, alpha=self.zoom_alpha
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
def inset_zoom(self):
|
|
181
|
+
"""
|
|
182
|
+
Apply zoom connectors to the inset axis based on the `zoom` attribute.
|
|
183
|
+
|
|
184
|
+
If `zoom` is True, the built-in zoom indication method is used.
|
|
185
|
+
If `zoom` is a tuple, manual zoom connectors are created using `manual_inset_zoom`.
|
|
186
|
+
|
|
187
|
+
Notes
|
|
188
|
+
--------------------
|
|
189
|
+
This method provides a unified interface for adding zoom connectors.
|
|
190
|
+
"""
|
|
191
|
+
if self.zoom is True:
|
|
192
|
+
self.indicate_inset_zoom()
|
|
193
|
+
elif isinstance(self.zoom, tuple):
|
|
194
|
+
self.manual_inset_zoom()
|
|
195
|
+
|
|
196
|
+
def set_minor_ticks(self):
|
|
197
|
+
"""
|
|
198
|
+
Enable minor ticks on the inset axis.
|
|
199
|
+
|
|
200
|
+
This method configures and displays minor ticks on both x and y axes
|
|
201
|
+
of the inset axis.
|
|
202
|
+
|
|
203
|
+
Notes
|
|
204
|
+
--------------------
|
|
205
|
+
Minor ticks enhance the readability of the inset axis.
|
|
206
|
+
"""
|
|
207
|
+
_minor_ticks = MinorTicks(self.axins)
|
|
208
|
+
_minor_ticks.set_minor_ticks_on(mode="xy")
|
|
209
|
+
|
|
210
|
+
def label(
|
|
211
|
+
self,
|
|
212
|
+
):
|
|
213
|
+
"""
|
|
214
|
+
Configure labels and axis limits for the inset axis.
|
|
215
|
+
|
|
216
|
+
This method sets the x and y axis labels and applies the specified
|
|
217
|
+
axis limits to the inset axis.
|
|
218
|
+
|
|
219
|
+
Raises:
|
|
220
|
+
ValueError: If `lab_lims` is not provided or has an invalid shape.
|
|
221
|
+
|
|
222
|
+
Notes
|
|
223
|
+
--------------------
|
|
224
|
+
This method utilizes the `Label` class to simplify axis labeling and limit configuration.
|
|
225
|
+
|
|
226
|
+
Examples
|
|
227
|
+
--------------------
|
|
228
|
+
>>> inset = InsetAxesBase(ax, axins, lab_lims=["X", "Y", 0, 1, 0, 1])
|
|
229
|
+
>>> inset.label()
|
|
230
|
+
"""
|
|
231
|
+
if not self.lab_lims:
|
|
232
|
+
raise ValueError("lab_lims must be provided")
|
|
233
|
+
|
|
234
|
+
_label = Label(
|
|
235
|
+
self.lab_lims,
|
|
236
|
+
self.x_pad,
|
|
237
|
+
self.y_pad,
|
|
238
|
+
minor_ticks_axes=False,
|
|
239
|
+
tight_layout=False,
|
|
240
|
+
**self.kwargs,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
try:
|
|
244
|
+
x_lab, y_lab, *lims = self.lab_lims
|
|
245
|
+
except ValueError:
|
|
246
|
+
raise ValueError("lab_lims has invalid shape")
|
|
247
|
+
|
|
248
|
+
# Label the inset axes
|
|
249
|
+
_label.configure_axis_labels(self.axins, x_lab, y_lab)
|
|
250
|
+
# Set the axis limits
|
|
251
|
+
_label.configure_axis_limits(self.axins, lims)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class AxesInset:
|
|
255
|
+
"""
|
|
256
|
+
A class to create and manage inset axes in a Matplotlib figure.
|
|
257
|
+
|
|
258
|
+
This class simplifies the creation of inset axes, providing options for zooming,
|
|
259
|
+
labeling, minor ticks, and custom axis transformations.
|
|
260
|
+
|
|
261
|
+
Parameters
|
|
262
|
+
--------------------
|
|
263
|
+
ax : Axes
|
|
264
|
+
The main axis in the figure.
|
|
265
|
+
bounds : tuple[float, float, float, float]
|
|
266
|
+
Bounds for the inset axis in the format (x0, y0, width, height).
|
|
267
|
+
transform : Transform | None, optional
|
|
268
|
+
The transform to apply to the inset axis. Default is None.
|
|
269
|
+
projection : str | None, optional
|
|
270
|
+
The projection type for the inset axis. Default is None.
|
|
271
|
+
polar : bool, default=False
|
|
272
|
+
If True, the inset axis will use a polar projection.
|
|
273
|
+
lab_lims : list[Any] | None, optional
|
|
274
|
+
List specifying axis labels and limits for the inset axis.
|
|
275
|
+
Expected format: [x_label, y_label, x_lim_min, x_lim_max, y_lim_min, y_lim_max].
|
|
276
|
+
minor_ticks : bool, default=True
|
|
277
|
+
Whether to enable minor ticks on the inset axis.
|
|
278
|
+
zoom : bool or tuple[tuple[int, int], tuple[int, int]], default=True
|
|
279
|
+
Zoom settings for the inset axis.
|
|
280
|
+
- If True, uses the built-in zoom indication.
|
|
281
|
+
- If a tuple, manually connects the axes with zoom connectors.
|
|
282
|
+
zoom_color : ColorType, default='black'
|
|
283
|
+
Color for the zoom connectors and patches.
|
|
284
|
+
zoom_alpha : int | float, default=0.3
|
|
285
|
+
Transparency for the zoom connectors and patches.
|
|
286
|
+
zorder : int | float, default=5
|
|
287
|
+
The z-order of the inset axis.
|
|
288
|
+
**kwargs : Any
|
|
289
|
+
Additional keyword arguments for label configuration or other customizations.
|
|
290
|
+
|
|
291
|
+
Methods
|
|
292
|
+
--------------------
|
|
293
|
+
axes_inset() -> Axes:
|
|
294
|
+
Creates and configures the inset axis, applying zoom, labels, and minor ticks.
|
|
295
|
+
|
|
296
|
+
Examples
|
|
297
|
+
--------------------
|
|
298
|
+
>>> import matplotlib.pyplot as plt
|
|
299
|
+
>>> fig, ax = plt.subplots()
|
|
300
|
+
>>> bounds = [0.5, 0.5, 0.4, 0.4]
|
|
301
|
+
>>> axins = AxesInset(ax, bounds, lab_lims=["X", "Y", 0, 1, 0, 1]).axes_inset()
|
|
302
|
+
>>> plt.show()
|
|
303
|
+
"""
|
|
304
|
+
|
|
305
|
+
def __init__(
|
|
306
|
+
self,
|
|
307
|
+
ax: Axes,
|
|
308
|
+
bounds: tuple[float, float, float, float],
|
|
309
|
+
transform: Transform | None = None,
|
|
310
|
+
projection: str | None = None,
|
|
311
|
+
polar: bool = False,
|
|
312
|
+
lab_lims: list[Any] | None = None,
|
|
313
|
+
minor_ticks: bool = True,
|
|
314
|
+
zoom: bool | tuple[tuple[int, int], tuple[int, int]] = True,
|
|
315
|
+
zoom_color: ColorType = "black",
|
|
316
|
+
zoom_alpha: int | float = 0.3,
|
|
317
|
+
zorder: int | float = 5,
|
|
318
|
+
**kwargs: Any,
|
|
319
|
+
) -> None:
|
|
320
|
+
self.ax: Axes = ax
|
|
321
|
+
self.bounds: tuple[float, float, float, float] = bounds
|
|
322
|
+
self.transform: Transform | None = transform
|
|
323
|
+
self.projection: str | None = projection
|
|
324
|
+
self.polar: bool = polar
|
|
325
|
+
|
|
326
|
+
self.lab_lims: list[Any] | None = lab_lims
|
|
327
|
+
self.minor_ticks: bool = minor_ticks
|
|
328
|
+
self.zoom: bool | tuple[tuple[int, int], tuple[int, int]] = zoom
|
|
329
|
+
self.zoom_color: ColorType = zoom_color
|
|
330
|
+
self.zoom_alpha: int | float = zoom_alpha
|
|
331
|
+
self.zorder: int | float = zorder
|
|
332
|
+
self.kwargs: Any = kwargs
|
|
333
|
+
|
|
334
|
+
def axes_inset(self) -> Axes:
|
|
335
|
+
"""
|
|
336
|
+
Create and configure the inset axis.
|
|
337
|
+
|
|
338
|
+
This method creates an inset axis using the specified bounds and properties,
|
|
339
|
+
applies zoom connectors if specified, adds axis labels and limits, and enables
|
|
340
|
+
minor ticks.
|
|
341
|
+
|
|
342
|
+
Returns
|
|
343
|
+
--------------------
|
|
344
|
+
axins : Axes
|
|
345
|
+
The created inset axis.
|
|
346
|
+
|
|
347
|
+
Notes
|
|
348
|
+
--------------------
|
|
349
|
+
- If `lab_lims` is provided, the inset axis will be labeled and have custom limits.
|
|
350
|
+
- If `zoom` is specified, zoom connectors will be added between the main and inset axes.
|
|
351
|
+
|
|
352
|
+
Examples
|
|
353
|
+
--------------------
|
|
354
|
+
>>> axins = AxesInset(ax, bounds).axes_inset()
|
|
355
|
+
>>> axins.plot([0, 1], [0, 1])
|
|
356
|
+
"""
|
|
357
|
+
axins = self.ax.inset_axes(
|
|
358
|
+
bounds=self.bounds,
|
|
359
|
+
transform=self.transform,
|
|
360
|
+
projection=self.projection,
|
|
361
|
+
polar=self.polar,
|
|
362
|
+
zorder=self.zorder,
|
|
363
|
+
)
|
|
364
|
+
self._axes_inset_base = InsetAxesBase(
|
|
365
|
+
ax=self.ax,
|
|
366
|
+
axins=axins,
|
|
367
|
+
minor_ticks=self.minor_ticks,
|
|
368
|
+
zoom=self.zoom,
|
|
369
|
+
zoom_color=self.zoom_color,
|
|
370
|
+
zoom_alpha=self.zoom_alpha,
|
|
371
|
+
lab_lims=self.lab_lims,
|
|
372
|
+
**self.kwargs,
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
if self.lab_lims:
|
|
376
|
+
self._axes_inset_base.label()
|
|
377
|
+
if self.zoom:
|
|
378
|
+
self._axes_inset_base.inset_zoom()
|
|
379
|
+
self._axes_inset_base.set_minor_ticks()
|
|
380
|
+
return axins
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
@bind_passed_params()
|
|
384
|
+
def axes_inset(
|
|
385
|
+
ax: Axes,
|
|
386
|
+
bounds: tuple[float, float, float, float],
|
|
387
|
+
transform: Transform | None = None,
|
|
388
|
+
projection: str | None = None,
|
|
389
|
+
polar: bool = False,
|
|
390
|
+
lab_lims: list[Any] | None = None,
|
|
391
|
+
minor_ticks: bool = True,
|
|
392
|
+
zoom: bool | tuple[tuple[int, int], tuple[int, int]] = True,
|
|
393
|
+
zoom_color: ColorType = "black",
|
|
394
|
+
zoom_alpha: int | float = 0.3,
|
|
395
|
+
zorder: int | float = 5,
|
|
396
|
+
**kwargs: Any,
|
|
397
|
+
) -> Axes:
|
|
398
|
+
"""
|
|
399
|
+
A functional interface to create an inset axis in a Matplotlib figure.
|
|
400
|
+
|
|
401
|
+
This function wraps the `AxesInset` class, allowing inset axes to be created
|
|
402
|
+
with a simpler function-based interface.
|
|
403
|
+
|
|
404
|
+
Parameters
|
|
405
|
+
--------------------
|
|
406
|
+
ax : Axes
|
|
407
|
+
The main axis in the figure.
|
|
408
|
+
bounds : tuple[float, float, float, float]
|
|
409
|
+
Bounds for the inset axis in the format (x0, y0, width, height).
|
|
410
|
+
transform : Transform | None, optional
|
|
411
|
+
The transform to apply to the inset axis. Default is None.
|
|
412
|
+
projection : str | None, optional
|
|
413
|
+
The projection type for the inset axis. Default is None.
|
|
414
|
+
polar : bool, default=False
|
|
415
|
+
If True, the inset axis will use a polar projection.
|
|
416
|
+
lab_lims : list[Any] | None, optional
|
|
417
|
+
Axis labels and limits for the inset axis.
|
|
418
|
+
minor_ticks : bool, default=True
|
|
419
|
+
Whether to enable minor ticks on the inset axis.
|
|
420
|
+
zoom : bool or tuple[tuple[int, int], tuple[int, int]], default=True
|
|
421
|
+
Zoom settings for the inset axis.
|
|
422
|
+
zoom_color : ColorType, default='black'
|
|
423
|
+
Color for the zoom connectors and patches.
|
|
424
|
+
zoom_alpha : int | float, default=0.3
|
|
425
|
+
Transparency for the zoom connectors and patches.
|
|
426
|
+
zorder : int | float, default=5
|
|
427
|
+
The z-order of the inset axis.
|
|
428
|
+
**kwargs : Any
|
|
429
|
+
Additional keyword arguments for label configuration or other customizations.
|
|
430
|
+
|
|
431
|
+
Returns
|
|
432
|
+
--------------------
|
|
433
|
+
axins : Axes
|
|
434
|
+
The created inset axis.
|
|
435
|
+
|
|
436
|
+
Notes
|
|
437
|
+
--------------------
|
|
438
|
+
zoom provides manual inset zooming when a tuple is provided.
|
|
439
|
+
zoom = ((1, 2), (3, 4)) will connect the main axis to the inset axis as follows:
|
|
440
|
+
|
|
441
|
+
- 1 (main) - 2 (inset)
|
|
442
|
+
- 3 (main) - 3 (inset)
|
|
443
|
+
|
|
444
|
+
The indices represent the corners of the axes, with 1 being the bottom left corner
|
|
445
|
+
|
|
446
|
+
Examples
|
|
447
|
+
--------------------
|
|
448
|
+
>>> import matplotlib.pyplot as plt
|
|
449
|
+
>>> fig, ax = plt.subplots()
|
|
450
|
+
>>> axins = axes_inset(ax, [0.5, 0.5, 0.4, 0.4], lab_lims=["X", "Y", 0, 1, 0, 1])
|
|
451
|
+
>>> axins.plot([0, 1], [0, 1])
|
|
452
|
+
"""
|
|
453
|
+
|
|
454
|
+
passed_params: dict[str, Any] = ParamsGetter("passed_params").get_bound_params()
|
|
455
|
+
class_params = CreateClassParams(passed_params).get_class_params()
|
|
456
|
+
|
|
457
|
+
_axes_inset = AxesInset(
|
|
458
|
+
class_params["ax"],
|
|
459
|
+
class_params["bounds"],
|
|
460
|
+
class_params["transform"],
|
|
461
|
+
class_params["projection"],
|
|
462
|
+
class_params["polar"],
|
|
463
|
+
class_params["lab_lims"],
|
|
464
|
+
class_params["minor_ticks"],
|
|
465
|
+
class_params["zoom"],
|
|
466
|
+
class_params["zoom_color"],
|
|
467
|
+
class_params["zoom_alpha"],
|
|
468
|
+
class_params["zorder"],
|
|
469
|
+
**class_params["kwargs"],
|
|
470
|
+
)
|
|
471
|
+
axins = _axes_inset.axes_inset()
|
|
472
|
+
return axins
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
class AxesInsetPadding:
|
|
476
|
+
"""
|
|
477
|
+
A class to create and manage inset axes with padding in a Matplotlib figure.
|
|
478
|
+
|
|
479
|
+
This class facilitates the creation of inset axes with precise control over
|
|
480
|
+
size, location, and additional padding. It also supports zooming, labeling,
|
|
481
|
+
and minor tick customization.
|
|
482
|
+
|
|
483
|
+
Parameters
|
|
484
|
+
--------------------
|
|
485
|
+
ax : Axes
|
|
486
|
+
The parent axis where the inset axis will be placed.
|
|
487
|
+
width : str or float
|
|
488
|
+
The width of the inset axis. Can be a float (absolute size) or a string
|
|
489
|
+
(e.g., "30%" relative to the parent axis).
|
|
490
|
+
height : str or float
|
|
491
|
+
The height of the inset axis. Can be a float (absolute size) or a string
|
|
492
|
+
(e.g., "30%" relative to the parent axis).
|
|
493
|
+
loc : str, default="upper right"
|
|
494
|
+
The location of the inset axis relative to the parent axis. Accepted values are:
|
|
495
|
+
"upper right", "upper left", "lower left", "lower right", etc.
|
|
496
|
+
borderpad : float, default=0.5
|
|
497
|
+
Padding between the parent axis and the inset axis.
|
|
498
|
+
bbox_to_anchor : tuple[float, float] | BboxBase | None, optional
|
|
499
|
+
The bounding box to anchor the inset axis.
|
|
500
|
+
bbox_transform : Transform | None, optional
|
|
501
|
+
Transformation for the bounding box anchor.
|
|
502
|
+
axes_kwargs : dict[str, Any] | None, optional
|
|
503
|
+
Additional keyword arguments to pass to the inset axis creation.
|
|
504
|
+
lab_lims : list[Any] | None, optional
|
|
505
|
+
Axis labels and limits for the inset axis.
|
|
506
|
+
Expected format: [x_label, y_label, x_lim_min, x_lim_max, y_lim_min, y_lim_max].
|
|
507
|
+
minor_ticks : bool, default=True
|
|
508
|
+
Whether to enable minor ticks on the inset axis.
|
|
509
|
+
zoom : bool or tuple[tuple[int, int], tuple[int, int]], default=True
|
|
510
|
+
Zoom settings for the inset axis.
|
|
511
|
+
- If True, uses the built-in zoom indication.
|
|
512
|
+
- If a tuple, manually connects the axes with zoom connectors.
|
|
513
|
+
zoom_color : ColorType, default="black"
|
|
514
|
+
Color for the zoom connectors and patches.
|
|
515
|
+
zoom_alpha : int | float, default=0.3
|
|
516
|
+
Transparency for the zoom connectors and patches.
|
|
517
|
+
**kwargs : Any
|
|
518
|
+
Additional keyword arguments for label configuration or other customizations.
|
|
519
|
+
|
|
520
|
+
Methods
|
|
521
|
+
--------------------
|
|
522
|
+
axes_inset() -> Axes:
|
|
523
|
+
Creates and configures the inset axis with the specified parameters.
|
|
524
|
+
|
|
525
|
+
Examples
|
|
526
|
+
--------------------
|
|
527
|
+
>>> import matplotlib.pyplot as plt
|
|
528
|
+
>>> from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
|
529
|
+
>>> fig, ax = plt.subplots()
|
|
530
|
+
>>> axins = AxesInsetPadding(ax, width="30%", height="30%", loc="upper right").axes_inset()
|
|
531
|
+
>>> axins.plot([0, 1], [0, 1])
|
|
532
|
+
>>> plt.show()
|
|
533
|
+
"""
|
|
534
|
+
|
|
535
|
+
def __init__(
|
|
536
|
+
self,
|
|
537
|
+
ax: Axes,
|
|
538
|
+
width: str | float,
|
|
539
|
+
height: str | float,
|
|
540
|
+
loc: str = "upper right",
|
|
541
|
+
borderpad: float = 0.5,
|
|
542
|
+
bbox_to_anchor: tuple[float, float] | BboxBase | None = None,
|
|
543
|
+
bbox_transform: Transform | None = None,
|
|
544
|
+
axes_kwargs: dict[str, Any] | None = None,
|
|
545
|
+
lab_lims: list[Any] | None = None,
|
|
546
|
+
minor_ticks: bool = True,
|
|
547
|
+
zoom: bool | tuple[tuple[int, int], tuple[int, int]] = True,
|
|
548
|
+
zoom_color: ColorType = "black",
|
|
549
|
+
zoom_alpha: int | float = 0.3,
|
|
550
|
+
**kwargs: Any,
|
|
551
|
+
) -> None:
|
|
552
|
+
self.ax: Axes = ax
|
|
553
|
+
self.width: str | float = width
|
|
554
|
+
self.height: str | float = height
|
|
555
|
+
self.loc: str = loc
|
|
556
|
+
self.borderpad: float = borderpad
|
|
557
|
+
self.bbox_to_anchor: tuple[float, float] | BboxBase | None = bbox_to_anchor
|
|
558
|
+
self.bbox_transform: Transform | None = bbox_transform
|
|
559
|
+
self.axes_kwargs: dict[str, Any] | None = axes_kwargs
|
|
560
|
+
|
|
561
|
+
self.lab_lims: list[Any] | None = lab_lims
|
|
562
|
+
self.minor_ticks: bool = minor_ticks
|
|
563
|
+
self.zoom: bool | tuple[tuple[int, int], tuple[int, int]] = zoom
|
|
564
|
+
self.zoom_color: ColorType = zoom_color
|
|
565
|
+
self.zoom_alpha: int | float = zoom_alpha
|
|
566
|
+
self.kwargs: Any = kwargs
|
|
567
|
+
|
|
568
|
+
def axes_inset(self) -> Axes:
|
|
569
|
+
"""
|
|
570
|
+
Create and configure an inset axis with padding.
|
|
571
|
+
|
|
572
|
+
This method uses `inset_axes` to create an inset axis with the specified
|
|
573
|
+
width, height, and padding. It applies zoom connectors, labels, and minor
|
|
574
|
+
ticks if specified.
|
|
575
|
+
|
|
576
|
+
Returns
|
|
577
|
+
--------------------
|
|
578
|
+
axins : Axes
|
|
579
|
+
The created inset axis.
|
|
580
|
+
|
|
581
|
+
Notes
|
|
582
|
+
--------------------
|
|
583
|
+
- If `lab_lims` is provided, the inset axis will be labeled and have custom limits.
|
|
584
|
+
- If `zoom` is specified, zoom connectors will be added between the main and inset axes.
|
|
585
|
+
|
|
586
|
+
Examples
|
|
587
|
+
--------------------
|
|
588
|
+
>>> axins = AxesInsetPadding(ax, "30%", "30%", loc="upper right").axes_inset()
|
|
589
|
+
>>> axins.plot([0, 1], [0, 1])
|
|
590
|
+
"""
|
|
591
|
+
axins = inset_axes(
|
|
592
|
+
parent_axes=self.ax,
|
|
593
|
+
width=self.width,
|
|
594
|
+
height=self.height,
|
|
595
|
+
loc=self.loc,
|
|
596
|
+
borderpad=self.borderpad,
|
|
597
|
+
bbox_to_anchor=self.bbox_to_anchor,
|
|
598
|
+
bbox_transform=self.bbox_transform,
|
|
599
|
+
axes_kwargs=self.axes_kwargs,
|
|
600
|
+
)
|
|
601
|
+
self._axes_inset_base = InsetAxesBase(
|
|
602
|
+
ax=self.ax,
|
|
603
|
+
axins=axins,
|
|
604
|
+
minor_ticks=self.minor_ticks,
|
|
605
|
+
zoom=self.zoom,
|
|
606
|
+
zoom_color=self.zoom_color,
|
|
607
|
+
zoom_alpha=self.zoom_alpha,
|
|
608
|
+
lab_lims=self.lab_lims,
|
|
609
|
+
**self.kwargs,
|
|
610
|
+
)
|
|
611
|
+
|
|
612
|
+
if self.lab_lims:
|
|
613
|
+
self._axes_inset_base.label()
|
|
614
|
+
if self.zoom:
|
|
615
|
+
self._axes_inset_base.inset_zoom()
|
|
616
|
+
self._axes_inset_base.set_minor_ticks()
|
|
617
|
+
return cast(Axes, axins)
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
@bind_passed_params()
|
|
621
|
+
def axes_inset_padding(
|
|
622
|
+
ax: Axes,
|
|
623
|
+
width: str | float,
|
|
624
|
+
height: str | float,
|
|
625
|
+
loc: str = "upper right",
|
|
626
|
+
borderpad: float = 0.5,
|
|
627
|
+
bbox_to_anchor: tuple[float, float] | BboxBase | None = None,
|
|
628
|
+
bbox_transform: Transform | None = None,
|
|
629
|
+
axes_kwargs: dict[str, Any] | None = None,
|
|
630
|
+
lab_lims: list[Any] | None = None,
|
|
631
|
+
minor_ticks: bool = True,
|
|
632
|
+
zoom: bool | tuple[tuple[int, int], tuple[int, int]] = True,
|
|
633
|
+
zoom_color: ColorType = "black",
|
|
634
|
+
zoom_alpha: int | float = 0.3,
|
|
635
|
+
**kwargs: Any,
|
|
636
|
+
) -> Axes:
|
|
637
|
+
"""
|
|
638
|
+
A functional interface to create an inset axis with padding in a Matplotlib figure.
|
|
639
|
+
|
|
640
|
+
This function wraps the `AxesInsetPadding` class, allowing inset axes to be created
|
|
641
|
+
with a simpler function-based interface.
|
|
642
|
+
|
|
643
|
+
Parameters
|
|
644
|
+
--------------------
|
|
645
|
+
ax : Axes
|
|
646
|
+
The parent axis where the inset axis will be placed.
|
|
647
|
+
width : str or float
|
|
648
|
+
The width of the inset axis.
|
|
649
|
+
height : str or float
|
|
650
|
+
The height of the inset axis.
|
|
651
|
+
loc : str, default="upper right"
|
|
652
|
+
The location of the inset axis relative to the parent axis.
|
|
653
|
+
borderpad : float, default=0.5
|
|
654
|
+
Padding between the parent axis and the inset axis.
|
|
655
|
+
bbox_to_anchor : tuple[float, float] | BboxBase | None, optional
|
|
656
|
+
Bounding box to anchor the inset axis.
|
|
657
|
+
bbox_transform : Transform | None, optional
|
|
658
|
+
Transformation for the bounding box anchor.
|
|
659
|
+
axes_kwargs : dict[str, Any] | None, optional
|
|
660
|
+
Additional keyword arguments for the inset axis creation.
|
|
661
|
+
lab_lims : list[Any] | None, optional
|
|
662
|
+
Axis labels and limits for the inset axis.
|
|
663
|
+
minor_ticks : bool, default=True
|
|
664
|
+
Whether to enable minor ticks on the inset axis.
|
|
665
|
+
zoom : bool or tuple[tuple[int, int], tuple[int, int]], default=True
|
|
666
|
+
Zoom settings for the inset axis.
|
|
667
|
+
zoom_color : ColorType, default="black"
|
|
668
|
+
Color for the zoom connectors and patches.
|
|
669
|
+
zoom_alpha : int | float, default=0.3
|
|
670
|
+
Transparency for the zoom connectors and patches.
|
|
671
|
+
**kwargs : Any
|
|
672
|
+
Additional keyword arguments for label configuration or other customizations.
|
|
673
|
+
|
|
674
|
+
Returns
|
|
675
|
+
--------------------
|
|
676
|
+
axins : Axes
|
|
677
|
+
The created inset axis.
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
Notes
|
|
681
|
+
--------------------
|
|
682
|
+
zoom provides manual inset zooming when a tuple is provided.
|
|
683
|
+
zoom = ((1, 2), (3, 4)) will connect the main axis to the inset axis as follows:
|
|
684
|
+
|
|
685
|
+
- 1 (main) - 2 (inset)
|
|
686
|
+
- 3 (main) - 3 (inset)
|
|
687
|
+
|
|
688
|
+
The indices represent the corners of the axes, with 1 being the bottom left corner
|
|
689
|
+
|
|
690
|
+
Examples
|
|
691
|
+
--------------------
|
|
692
|
+
>>> import matplotlib.pyplot as plt
|
|
693
|
+
>>> fig, ax = plt.subplots()
|
|
694
|
+
>>> axins = axes_inset_padding(ax, "30%", "30%", loc="upper right", zoom=False)
|
|
695
|
+
>>> axins.plot([0, 1], [0, 1])
|
|
696
|
+
"""
|
|
697
|
+
|
|
698
|
+
passed_params: dict[str, Any] = ParamsGetter("passed_params").get_bound_params()
|
|
699
|
+
class_params = CreateClassParams(passed_params).get_class_params()
|
|
700
|
+
|
|
701
|
+
_axes_inset_padding = AxesInsetPadding(
|
|
702
|
+
class_params["ax"],
|
|
703
|
+
class_params["width"],
|
|
704
|
+
class_params["height"],
|
|
705
|
+
class_params["loc"],
|
|
706
|
+
class_params["borderpad"],
|
|
707
|
+
class_params["bbox_to_anchor"],
|
|
708
|
+
class_params["bbox_transform"],
|
|
709
|
+
class_params["axes_kwargs"],
|
|
710
|
+
class_params["lab_lims"],
|
|
711
|
+
class_params["minor_ticks"],
|
|
712
|
+
class_params["zoom"],
|
|
713
|
+
class_params["zoom_color"],
|
|
714
|
+
class_params["zoom_alpha"],
|
|
715
|
+
**class_params["kwargs"],
|
|
716
|
+
)
|
|
717
|
+
axins = _axes_inset_padding.axes_inset()
|
|
718
|
+
return axins
|
|
@@ -507,8 +507,8 @@ class Label:
|
|
|
507
507
|
def __init__(
|
|
508
508
|
self,
|
|
509
509
|
lab_lims: list[Any],
|
|
510
|
-
x_pad: int = 2,
|
|
511
|
-
y_pad: int = 2,
|
|
510
|
+
x_pad: int | float = 2,
|
|
511
|
+
y_pad: int | float = 2,
|
|
512
512
|
minor_ticks_axes: bool = True,
|
|
513
513
|
tight_layout: bool = True,
|
|
514
514
|
*args: Any,
|
|
@@ -516,8 +516,8 @@ class Label:
|
|
|
516
516
|
) -> None:
|
|
517
517
|
|
|
518
518
|
self.lab_lims: list[Any] = lab_lims
|
|
519
|
-
self.x_pad: int = x_pad
|
|
520
|
-
self.y_pad: int = y_pad
|
|
519
|
+
self.x_pad: int | float = x_pad
|
|
520
|
+
self.y_pad: int | float = y_pad
|
|
521
521
|
self.minor_ticks_axes: bool = minor_ticks_axes
|
|
522
522
|
self.tight_layout: bool = tight_layout
|
|
523
523
|
self.args: Any = args
|
|
@@ -638,15 +638,19 @@ class Label:
|
|
|
638
638
|
--------------------
|
|
639
639
|
None
|
|
640
640
|
"""
|
|
641
|
-
if x_lab:
|
|
641
|
+
if isinstance(x_lab, str):
|
|
642
642
|
ax.set_xlabel(x_lab)
|
|
643
|
-
|
|
643
|
+
elif x_lab is None:
|
|
644
644
|
self.remove_xlabels(ax)
|
|
645
|
+
else:
|
|
646
|
+
raise ValueError("Invalid x-axis label. Must be a string or None.")
|
|
645
647
|
|
|
646
|
-
if y_lab:
|
|
648
|
+
if isinstance(y_lab, str):
|
|
647
649
|
ax.set_ylabel(y_lab)
|
|
648
|
-
|
|
650
|
+
elif y_lab is None:
|
|
649
651
|
self.remove_ylabels(ax)
|
|
652
|
+
else:
|
|
653
|
+
raise ValueError("Invalid y-axis label. Must be a string or None.")
|
|
650
654
|
|
|
651
655
|
def configure_axis_limits(
|
|
652
656
|
self,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import warnings
|
|
1
2
|
from typing import Any
|
|
2
3
|
|
|
3
4
|
import matplotlib.pyplot as plt
|
|
@@ -197,8 +198,10 @@ class LegendAxes:
|
|
|
197
198
|
"""
|
|
198
199
|
_lg_list = []
|
|
199
200
|
for ax in plt.gcf().axes:
|
|
200
|
-
|
|
201
|
-
|
|
201
|
+
with warnings.catch_warnings():
|
|
202
|
+
warnings.simplefilter("ignore")
|
|
203
|
+
_lg = ax.legend(*self.args, **self.kwargs)
|
|
204
|
+
_lg_list.append(_lg)
|
|
202
205
|
return _lg_list
|
|
203
206
|
|
|
204
207
|
|
gsplot-0.1.0/gsplot/version.py
DELETED
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|