gsplot 0.1.3__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.
Files changed (35) hide show
  1. {gsplot-0.1.3 → gsplot-0.2.0}/PKG-INFO +7 -7
  2. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/figure/axes.py +16 -23
  3. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/style/label.py +41 -2
  4. gsplot-0.2.0/gsplot/version.py +2 -0
  5. {gsplot-0.1.3 → gsplot-0.2.0}/pyproject.toml +7 -7
  6. gsplot-0.1.3/gsplot/version.py +0 -2
  7. {gsplot-0.1.3 → gsplot-0.2.0}/LICENSE +0 -0
  8. {gsplot-0.1.3 → gsplot-0.2.0}/README.md +0 -0
  9. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/__init__.py +0 -0
  10. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/base/base.py +0 -0
  11. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/base/base_alias_validator.py +0 -0
  12. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/color/colormap.py +0 -0
  13. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/config/config.py +0 -0
  14. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/data/load_file.py +0 -0
  15. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/figure/axes_base.py +0 -0
  16. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/figure/axes_inset.py +0 -0
  17. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/figure/axes_range_base.py +0 -0
  18. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/figure/figure_tools.py +0 -0
  19. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/figure/show.py +0 -0
  20. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/figure/store.py +0 -0
  21. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/hello_world/hello_world.py +0 -0
  22. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/logger.py +0 -0
  23. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/path/path.py +0 -0
  24. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/plot/line.py +0 -0
  25. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/plot/line_base.py +0 -0
  26. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/plot/line_colormap_base.py +0 -0
  27. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/plot/line_colormap_dashed.py +0 -0
  28. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/plot/line_colormap_solid.py +0 -0
  29. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/plot/scatter.py +0 -0
  30. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/plot/scatter_colormap.py +0 -0
  31. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/style/graph.py +0 -0
  32. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/style/legend.py +0 -0
  33. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/style/legend_colormap.py +0 -0
  34. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/style/ticks.py +0 -0
  35. {gsplot-0.1.3 → gsplot-0.2.0}/gsplot/style/title.py +0 -0
@@ -1,20 +1,20 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: gsplot
3
- Version: 0.1.3
3
+ Version: 0.2.0
4
4
  Summary: General-scientific plot based on matplotlib
5
5
  Author: Giordano Mattoni
6
6
  Author-email: mattoni@scphys.kyoto-u.ac.jp
7
- Requires-Python: >=3.10,<4.0
7
+ Requires-Python: >=3.10
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
- Requires-Dist: matplotlib (>=3.9.0,<4.0.0)
14
- Requires-Dist: numpy (>=1.26.4,<2.0.0)
15
- Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
16
- Requires-Dist: rich (>=13.9.4,<14.0.0)
17
- Requires-Dist: types-pyyaml (>=6.0.12.20240917,<7.0.0.0)
13
+ Requires-Dist: matplotlib (>=3.9.0)
14
+ Requires-Dist: numpy (>=1.26.4)
15
+ Requires-Dist: pyyaml (>=6.0.2)
16
+ Requires-Dist: rich (>=13.9.4)
17
+ Requires-Dist: types-pyyaml (>=6.0.12.20240917)
18
18
  Project-URL: Homepage, https://soichiroyamane.github.io/gsplot/
19
19
  Description-Content-Type: text/markdown
20
20
 
@@ -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 : list of int or float, optional
154
- The size of the figure in the specified unit (default is [5, 5]).
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 pass to Matplotlib's figure creation methods.
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 : list of int or float
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=[10, 8],
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: list[int | float] = [5, 5],
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: list[int | float] = 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=[10, 8], unit="cm", mosaic="AB;CD", ion=True)
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, *self.args, **self.kwargs)
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: list[int | float] = [5, 5],
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 : list of int or float, optional
314
- The size of the figure in the specified unit (default is [5, 5]).
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 Matplotlib's figure creation methods.
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=[10, 8], unit="cm", mosaic="AB;CD", ion=True)
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
- self.configure_axis_limits(ax, lims, final_axes_ranges)
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
  """
@@ -0,0 +1,2 @@
1
+ __version__ = '0.2.0'
2
+ __commit__ = '1d0c220a25e2ec79eea0d73212d4631524f25150'
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "gsplot"
3
3
 
4
- version = "0.1.3"
4
+ version = "0.2.0"
5
5
 
6
6
  description = "General-scientific plot based on matplotlib"
7
7
  authors = [
@@ -14,12 +14,12 @@ readme = "README.md"
14
14
  Homepage = "https://soichiroyamane.github.io/gsplot/"
15
15
 
16
16
  [tool.poetry.dependencies]
17
- python = "^3.10"
18
- matplotlib = "^3.9.0"
19
- numpy = "^1.26.4"
20
- rich = "^13.9.4"
21
- pyyaml = "^6.0.2"
22
- types-pyyaml = "^6.0.12.20240917"
17
+ python = ">=3.10"
18
+ matplotlib = ">=3.9.0"
19
+ numpy = ">=1.26.4"
20
+ rich = ">=13.9.4"
21
+ pyyaml = ">=6.0.2"
22
+ types-pyyaml = ">=6.0.12.20240917"
23
23
 
24
24
 
25
25
  [tool.poetry.group.dev.dependencies]
@@ -1,2 +0,0 @@
1
- __version__ = '0.1.3'
2
- __commit__ = '637c2d2e807a84c94b172b28e5c736bd885c3469'
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