gsplot 0.1.4__tar.gz → 0.2.0__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.4 → gsplot-0.2.0}/PKG-INFO +1 -1
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/figure/axes.py +16 -23
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/style/label.py +41 -2
- gsplot-0.2.0/gsplot/version.py +2 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/pyproject.toml +1 -1
- gsplot-0.1.4/gsplot/version.py +0 -2
- {gsplot-0.1.4 → gsplot-0.2.0}/LICENSE +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/README.md +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/__init__.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/base/base.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/base/base_alias_validator.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/color/colormap.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/config/config.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/data/load_file.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/figure/axes_base.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/figure/axes_inset.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/figure/axes_range_base.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/figure/figure_tools.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/figure/show.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/figure/store.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/hello_world/hello_world.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/logger.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/path/path.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/plot/line.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/plot/line_base.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/plot/line_colormap_base.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/plot/line_colormap_dashed.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/plot/line_colormap_solid.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/plot/scatter.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/plot/scatter_colormap.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/style/graph.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/style/legend.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/style/legend_colormap.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/style/ticks.py +0 -0
- {gsplot-0.1.4 → gsplot-0.2.0}/gsplot/style/title.py +0 -0
|
@@ -150,8 +150,8 @@ class AxesHandler(Generic[_T]):
|
|
|
150
150
|
--------------------
|
|
151
151
|
store : bool, optional
|
|
152
152
|
Whether to use a shared storage for axes or figure states (default is False).
|
|
153
|
-
size :
|
|
154
|
-
The size of the figure in the specified unit (default is
|
|
153
|
+
size : tuple of int or float, optional
|
|
154
|
+
The size of the figure in the specified unit (default is (5, 5)).
|
|
155
155
|
unit : str, optional
|
|
156
156
|
The unit for the figure size. Supported units are "mm", "cm", "in", and "pt" (default is "in").
|
|
157
157
|
mosaic : str or list of HashableList[_T] or list of HashableList[Hashable], optional
|
|
@@ -160,16 +160,14 @@ class AxesHandler(Generic[_T]):
|
|
|
160
160
|
Whether to clear the current figure before creating a new one (default is True).
|
|
161
161
|
ion : bool, optional
|
|
162
162
|
Whether to enable interactive mode for the figure (default is False).
|
|
163
|
-
*args : Any
|
|
164
|
-
Additional positional arguments to pass to Matplotlib's figure creation methods.
|
|
165
163
|
**kwargs : Any
|
|
166
|
-
Additional keyword arguments to
|
|
164
|
+
Additional keyword arguments to pas to `subplot_mosaic`.
|
|
167
165
|
|
|
168
166
|
Attributes
|
|
169
167
|
--------------------
|
|
170
168
|
store : bool
|
|
171
169
|
Indicates whether shared storage is used.
|
|
172
|
-
size :
|
|
170
|
+
size : tuple of int or float
|
|
173
171
|
The size of the figure in the specified unit.
|
|
174
172
|
unit : {"mm", "cm", "in", "pt"}
|
|
175
173
|
The unit for the figure size.
|
|
@@ -194,7 +192,7 @@ class AxesHandler(Generic[_T]):
|
|
|
194
192
|
Examples
|
|
195
193
|
--------------------
|
|
196
194
|
>>> handler = AxesHandler(
|
|
197
|
-
... size=
|
|
195
|
+
... size=(10, 8),
|
|
198
196
|
... unit="cm",
|
|
199
197
|
... mosaic="AB;CD",
|
|
200
198
|
... ion=True
|
|
@@ -208,23 +206,22 @@ class AxesHandler(Generic[_T]):
|
|
|
208
206
|
def __init__(
|
|
209
207
|
self,
|
|
210
208
|
store: bool = False,
|
|
211
|
-
size:
|
|
209
|
+
size: tuple[int | float, int | float] = (5, 5),
|
|
212
210
|
unit: Literal["mm", "cm", "in", "pt"] = "in",
|
|
213
211
|
mosaic: str | list[HashableList[_T]] | list[HashableList[Hashable]] = "A",
|
|
214
212
|
clear: bool = True,
|
|
215
213
|
ion: bool = False,
|
|
216
|
-
*args: Any,
|
|
217
214
|
**kwargs: Any,
|
|
218
215
|
) -> None:
|
|
219
216
|
self.store = store
|
|
220
|
-
self.size:
|
|
217
|
+
self.size: tuple[int | float, int | float] = size
|
|
221
218
|
self.unit: str = unit
|
|
222
219
|
self.mosaic: str | list[HashableList[_T]] | list[HashableList[Hashable]] = (
|
|
223
220
|
mosaic
|
|
224
221
|
)
|
|
222
|
+
|
|
225
223
|
self.clear: bool = clear
|
|
226
224
|
self.ion: bool = ion
|
|
227
|
-
self.args: Any = args
|
|
228
225
|
self.kwargs: Any = kwargs
|
|
229
226
|
|
|
230
227
|
self._store_singleton = StoreSingleton()
|
|
@@ -256,7 +253,7 @@ class AxesHandler(Generic[_T]):
|
|
|
256
253
|
|
|
257
254
|
Examples
|
|
258
255
|
--------------------
|
|
259
|
-
>>> handler = AxesHandler(size=
|
|
256
|
+
>>> handler = AxesHandler(size=(10, 8), unit="cm", mosaic="AB;CD", ion=True)
|
|
260
257
|
>>> handler.create_figure()
|
|
261
258
|
"""
|
|
262
259
|
NumLines().reset()
|
|
@@ -274,11 +271,10 @@ class AxesHandler(Generic[_T]):
|
|
|
274
271
|
self.unit_conv.convert(self.size[0], self.unit_enum),
|
|
275
272
|
self.unit_conv.convert(self.size[1], self.unit_enum),
|
|
276
273
|
)
|
|
277
|
-
plt.gcf().set_size_inches(*conv_size
|
|
274
|
+
plt.gcf().set_size_inches(*conv_size)
|
|
278
275
|
|
|
279
276
|
if self.mosaic != "":
|
|
280
|
-
plt.gcf().subplot_mosaic(self.mosaic)
|
|
281
|
-
|
|
277
|
+
plt.gcf().subplot_mosaic(mosaic=self.mosaic, **self.kwargs)
|
|
282
278
|
# To ensure that the axes are tightly packed, otherwise axes sizes will be different after tight_layout is called
|
|
283
279
|
plt.tight_layout()
|
|
284
280
|
else:
|
|
@@ -291,12 +287,11 @@ class AxesHandler(Generic[_T]):
|
|
|
291
287
|
@bind_passed_params()
|
|
292
288
|
def axes(
|
|
293
289
|
store: bool = False,
|
|
294
|
-
size:
|
|
290
|
+
size: tuple[int | float, int | float] = (5, 5),
|
|
295
291
|
unit: Literal["mm", "cm", "in", "pt"] = "in",
|
|
296
292
|
mosaic: str | list[HashableList[_T]] | list[HashableList[Hashable]] = "A",
|
|
297
293
|
clear: bool = True,
|
|
298
294
|
ion: bool = False,
|
|
299
|
-
*args: Any,
|
|
300
295
|
**kwargs: Any,
|
|
301
296
|
):
|
|
302
297
|
"""
|
|
@@ -310,8 +305,8 @@ def axes(
|
|
|
310
305
|
--------------------
|
|
311
306
|
store : bool, optional
|
|
312
307
|
Whether to use a shared storage for axes or figure states (default is False).
|
|
313
|
-
size :
|
|
314
|
-
The size of the figure in the specified unit (default is
|
|
308
|
+
size : tuple of int or float, optional
|
|
309
|
+
The size of the figure in the specified unit (default is (5, 5)).
|
|
315
310
|
unit : {"mm", "cm", "in", "pt"}, optional
|
|
316
311
|
The unit for the figure size. Supported units are "mm", "cm", "in", and "pt" (default is "in").
|
|
317
312
|
mosaic : str or list of HashableList[_T] or list of HashableList[Hashable], optional
|
|
@@ -320,10 +315,8 @@ def axes(
|
|
|
320
315
|
Whether to clear the current figure before creating a new one (default is True).
|
|
321
316
|
ion : bool, optional
|
|
322
317
|
Whether to enable interactive mode for the figure (default is False).
|
|
323
|
-
*args : Any
|
|
324
|
-
Additional positional arguments to pass to Matplotlib's figure creation methods.
|
|
325
318
|
**kwargs : Any
|
|
326
|
-
Additional keyword arguments to pass to
|
|
319
|
+
Additional keyword arguments to pass to `subplot_mosaic`.
|
|
327
320
|
|
|
328
321
|
Notes
|
|
329
322
|
--------------------
|
|
@@ -339,7 +332,7 @@ def axes(
|
|
|
339
332
|
Examples
|
|
340
333
|
--------------------
|
|
341
334
|
>>> import gsplot as
|
|
342
|
-
>>> axs = gs.axes(size=
|
|
335
|
+
>>> axs = gs.axes(size=(10, 8), unit="cm", mosaic="AB;CD", ion=True)
|
|
343
336
|
>>> print(axs)
|
|
344
337
|
[<Axes: label='A'>, <Axes: label='B'>, <Axes: label='C'>, <Axes: label='D'>]
|
|
345
338
|
"""
|
|
@@ -758,8 +758,47 @@ class Label:
|
|
|
758
758
|
ax, x_lab, y_lab, self.xpad_label, self.ypad_label, **self.kwargs
|
|
759
759
|
)
|
|
760
760
|
|
|
761
|
-
# Configure axis limits and scales
|
|
762
|
-
|
|
761
|
+
# Configure axis limits and scales if not polar axis
|
|
762
|
+
if not ax.name.startswith("polar"):
|
|
763
|
+
self.configure_axis_limits(ax, lims, final_axes_ranges)
|
|
764
|
+
else:
|
|
765
|
+
self._configure_polar_axis(ax, x_lab, y_lab, lims)
|
|
766
|
+
|
|
767
|
+
def _configure_polar_axis(
|
|
768
|
+
self, ax: Axes, x_lab: str, y_lab: str, lims: list
|
|
769
|
+
) -> None:
|
|
770
|
+
"""
|
|
771
|
+
Configures labels and limits for a polar axis.
|
|
772
|
+
Parameters
|
|
773
|
+
--------------------
|
|
774
|
+
ax : Axes
|
|
775
|
+
The polar axis to configure.
|
|
776
|
+
x_lab : str
|
|
777
|
+
The label for the x-axis (theta).
|
|
778
|
+
y_lab : str
|
|
779
|
+
The label for the y-axis (r).
|
|
780
|
+
lims : list
|
|
781
|
+
The limits for the polar axis, where lims[0] is theta limits and lims[1] is r limits.
|
|
782
|
+
Returns
|
|
783
|
+
--------------------
|
|
784
|
+
None
|
|
785
|
+
"""
|
|
786
|
+
# Set labels for polar axis
|
|
787
|
+
ax.set_xlabel(x_lab, labelpad=self.xpad_label, **self.kwargs)
|
|
788
|
+
ax.set_ylabel(y_lab, labelpad=self.ypad_label, **self.kwargs)
|
|
789
|
+
# Set limits for polar axis: theta
|
|
790
|
+
# check if component is a number
|
|
791
|
+
if isinstance(lims[0][0], (int, float)) and isinstance(
|
|
792
|
+
lims[0][1], (int, float)
|
|
793
|
+
):
|
|
794
|
+
ax.set_thetamin(lims[0][0]) # type: ignore # mypy-ignore[no-untyped-call]
|
|
795
|
+
ax.set_thetamax(lims[0][1]) # type: ignore # mypy-ignore[no-untyped-call]
|
|
796
|
+
# Set limits for polar axis: r
|
|
797
|
+
if isinstance(lims[1][0], (int, float)) and isinstance(
|
|
798
|
+
lims[1][1], (int, float)
|
|
799
|
+
):
|
|
800
|
+
ax.set_rmin(lims[1][0]) # type: ignore # mypy-ignore[no-untyped-call]
|
|
801
|
+
ax.set_rmax(lims[1][1]) # type: ignore # mypy-ignore[no-untyped-call]
|
|
763
802
|
|
|
764
803
|
def _calculate_padding_range(self, range: NDArray[Any]) -> NDArray[Any]:
|
|
765
804
|
"""
|
gsplot-0.1.4/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|