gsplot 0.1.4__tar.gz → 0.3.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 (37) hide show
  1. gsplot-0.3.0/PKG-INFO +130 -0
  2. gsplot-0.3.0/README.md +107 -0
  3. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/__init__.py +23 -7
  4. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/config/config.py +14 -12
  5. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/figure/axes.py +18 -25
  6. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/figure/axes_inset.py +1 -2
  7. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/plot/line.py +2 -2
  8. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/plot/line_colormap_dashed.py +6 -3
  9. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/plot/line_colormap_solid.py +4 -2
  10. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/style/label.py +46 -4
  11. gsplot-0.3.0/gsplot/version.py +2 -0
  12. {gsplot-0.1.4 → gsplot-0.3.0}/pyproject.toml +21 -10
  13. gsplot-0.1.4/PKG-INFO +0 -83
  14. gsplot-0.1.4/README.md +0 -62
  15. gsplot-0.1.4/gsplot/version.py +0 -2
  16. {gsplot-0.1.4 → gsplot-0.3.0}/LICENSE +0 -0
  17. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/base/base.py +0 -0
  18. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/base/base_alias_validator.py +0 -0
  19. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/color/colormap.py +0 -0
  20. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/data/load_file.py +0 -0
  21. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/figure/axes_base.py +0 -0
  22. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/figure/axes_range_base.py +0 -0
  23. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/figure/figure_tools.py +0 -0
  24. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/figure/show.py +0 -0
  25. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/figure/store.py +0 -0
  26. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/hello_world/hello_world.py +0 -0
  27. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/logger.py +0 -0
  28. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/path/path.py +0 -0
  29. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/plot/line_base.py +0 -0
  30. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/plot/line_colormap_base.py +0 -0
  31. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/plot/scatter.py +0 -0
  32. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/plot/scatter_colormap.py +0 -0
  33. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/style/graph.py +0 -0
  34. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/style/legend.py +0 -0
  35. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/style/legend_colormap.py +0 -0
  36. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/style/ticks.py +0 -0
  37. {gsplot-0.1.4 → gsplot-0.3.0}/gsplot/style/title.py +0 -0
gsplot-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.4
2
+ Name: gsplot
3
+ Version: 0.3.0
4
+ Summary: General-scientific plot based on matplotlib
5
+ License-File: LICENSE
6
+ Author: Giordano Mattoni
7
+ Author-email: mattoni@scphys.kyoto-u.ac.jp
8
+ Requires-Python: >=3.10
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Requires-Dist: matplotlib (>=3.9.0)
16
+ Requires-Dist: numpy (>=1.26.4)
17
+ Requires-Dist: pyyaml (>=6.0.2)
18
+ Requires-Dist: rich (>=13.9.4)
19
+ Requires-Dist: types-pyyaml (>=6.0.12.20240917)
20
+ Project-URL: Homepage, https://soichiroyamane.github.io/gsplot/
21
+ Description-Content-Type: text/markdown
22
+
23
+ <div align="center">
24
+ <img src="docs/_static/logo/logo_title_gsplot.png" alt="gsplot logo" width="300">
25
+ </div>
26
+
27
+ [![Documentation](https://github.com/SoichiroYamane/gsplot/actions/workflows/gh-pages-sphinx.yml/badge.svg)](https://soichiroyamane.github.io/gsplot/stable/)
28
+ [![PyPI](https://img.shields.io/pypi/v/gsplot)](https://pypi.org/project/gsplot/)
29
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)
30
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green)](LICENSE)
31
+
32
+ # gsplot
33
+
34
+ `gsplot` is a small scientific-plotting toolkit built on Matplotlib. It adds
35
+ convenient figure layouts, consistent styling helpers, configurable defaults,
36
+ and lightweight version/configuration metadata while keeping ordinary
37
+ Matplotlib `Figure` and `Axes` objects in the workflow.
38
+
39
+ The package is still evolving. Check the [documentation](https://soichiroyamane.github.io/gsplot/stable/)
40
+ and the [issue tracker](https://github.com/SoichiroYamane/gsplot/issues) before
41
+ depending on behavior that is not covered by the public API.
42
+
43
+ ## Install
44
+
45
+ `gsplot` supports Python 3.10 and newer:
46
+
47
+ ```bash
48
+ python -m pip install gsplot
49
+ ```
50
+
51
+ ## Quick example
52
+
53
+ ```python
54
+ import gsplot as gs
55
+
56
+ axes = gs.axes(size=(8, 4), mosaic="AB", store=True)
57
+ gs.line(axes[0], [0, 1, 2], [0, 1, 4], label="quadratic")
58
+ gs.scatter(axes[1], [0, 1, 2], [0, 1, 4], label="samples")
59
+ gs.legend_axes()
60
+ gs.show("quickstart", show=False)
61
+ ```
62
+
63
+ This creates a two-panel Matplotlib figure, saves `quickstart.png` when
64
+ storage is enabled, and remains compatible with regular Matplotlib operations:
65
+
66
+ ```python
67
+ axes[0].set_title("A regular Matplotlib Axes")
68
+ ```
69
+
70
+ For a complete scientific example, see the
71
+ [paper-plot demo](https://soichiroyamane.github.io/gsplot/stable/guides/demo/4_paper_plot.html).
72
+
73
+ ## Configuration
74
+
75
+ Place a `gsplot.json` file in the working directory, or in
76
+ `~/.config/gsplot/gsplot.json`, to provide defaults for supported functions.
77
+ The first matching location is used. A path can also be loaded explicitly:
78
+
79
+ ```python
80
+ import gsplot as gs
81
+
82
+ gs.config_load("path/to/gsplot.json")
83
+ ```
84
+
85
+ When a value is specified more than once, the precedence is:
86
+
87
+ 1. an argument passed directly to the function;
88
+ 2. the corresponding function entry in `gsplot.json`;
89
+ 3. the function's default value.
90
+
91
+ See the [configuration guide](https://soichiroyamane.github.io/gsplot/stable/guides/demo/3_config.html)
92
+ for the supported file layout and backend notes.
93
+
94
+ ## Development
95
+
96
+ The repository uses Poetry and targets Python 3.10 or newer. With a compatible
97
+ Python interpreter:
98
+
99
+ ```bash
100
+ python -m pip install "poetry==2.4.1"
101
+ poetry install
102
+ MPLBACKEND=Agg poetry run pytest -q
103
+ MPLBACKEND=Agg poetry run sphinx-build -W -b html docs docs/_build/html
104
+ ```
105
+
106
+ The demos under `demo/` are executable documentation. Run one from its own
107
+ directory, for example:
108
+
109
+ ```bash
110
+ cd demo/1_axes
111
+ python axes.py
112
+ ```
113
+
114
+ See [the developer setup guide](docs/reference/contribution/developer_env.md)
115
+ for formatting, type checking, packaging, and Docker instructions.
116
+
117
+ For private vulnerability reports and the supported-version policy, see
118
+ [SECURITY.md](SECURITY.md).
119
+
120
+ ## Authors
121
+
122
+ This repository was forked from code developed by Giordano Mattoni.
123
+
124
+ - Giordano Mattoni
125
+ - Soichiro Yamane
126
+
127
+ ## License
128
+
129
+ This project is distributed under the [MIT License](LICENSE).
130
+
gsplot-0.3.0/README.md ADDED
@@ -0,0 +1,107 @@
1
+ <div align="center">
2
+ <img src="docs/_static/logo/logo_title_gsplot.png" alt="gsplot logo" width="300">
3
+ </div>
4
+
5
+ [![Documentation](https://github.com/SoichiroYamane/gsplot/actions/workflows/gh-pages-sphinx.yml/badge.svg)](https://soichiroyamane.github.io/gsplot/stable/)
6
+ [![PyPI](https://img.shields.io/pypi/v/gsplot)](https://pypi.org/project/gsplot/)
7
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green)](LICENSE)
9
+
10
+ # gsplot
11
+
12
+ `gsplot` is a small scientific-plotting toolkit built on Matplotlib. It adds
13
+ convenient figure layouts, consistent styling helpers, configurable defaults,
14
+ and lightweight version/configuration metadata while keeping ordinary
15
+ Matplotlib `Figure` and `Axes` objects in the workflow.
16
+
17
+ The package is still evolving. Check the [documentation](https://soichiroyamane.github.io/gsplot/stable/)
18
+ and the [issue tracker](https://github.com/SoichiroYamane/gsplot/issues) before
19
+ depending on behavior that is not covered by the public API.
20
+
21
+ ## Install
22
+
23
+ `gsplot` supports Python 3.10 and newer:
24
+
25
+ ```bash
26
+ python -m pip install gsplot
27
+ ```
28
+
29
+ ## Quick example
30
+
31
+ ```python
32
+ import gsplot as gs
33
+
34
+ axes = gs.axes(size=(8, 4), mosaic="AB", store=True)
35
+ gs.line(axes[0], [0, 1, 2], [0, 1, 4], label="quadratic")
36
+ gs.scatter(axes[1], [0, 1, 2], [0, 1, 4], label="samples")
37
+ gs.legend_axes()
38
+ gs.show("quickstart", show=False)
39
+ ```
40
+
41
+ This creates a two-panel Matplotlib figure, saves `quickstart.png` when
42
+ storage is enabled, and remains compatible with regular Matplotlib operations:
43
+
44
+ ```python
45
+ axes[0].set_title("A regular Matplotlib Axes")
46
+ ```
47
+
48
+ For a complete scientific example, see the
49
+ [paper-plot demo](https://soichiroyamane.github.io/gsplot/stable/guides/demo/4_paper_plot.html).
50
+
51
+ ## Configuration
52
+
53
+ Place a `gsplot.json` file in the working directory, or in
54
+ `~/.config/gsplot/gsplot.json`, to provide defaults for supported functions.
55
+ The first matching location is used. A path can also be loaded explicitly:
56
+
57
+ ```python
58
+ import gsplot as gs
59
+
60
+ gs.config_load("path/to/gsplot.json")
61
+ ```
62
+
63
+ When a value is specified more than once, the precedence is:
64
+
65
+ 1. an argument passed directly to the function;
66
+ 2. the corresponding function entry in `gsplot.json`;
67
+ 3. the function's default value.
68
+
69
+ See the [configuration guide](https://soichiroyamane.github.io/gsplot/stable/guides/demo/3_config.html)
70
+ for the supported file layout and backend notes.
71
+
72
+ ## Development
73
+
74
+ The repository uses Poetry and targets Python 3.10 or newer. With a compatible
75
+ Python interpreter:
76
+
77
+ ```bash
78
+ python -m pip install "poetry==2.4.1"
79
+ poetry install
80
+ MPLBACKEND=Agg poetry run pytest -q
81
+ MPLBACKEND=Agg poetry run sphinx-build -W -b html docs docs/_build/html
82
+ ```
83
+
84
+ The demos under `demo/` are executable documentation. Run one from its own
85
+ directory, for example:
86
+
87
+ ```bash
88
+ cd demo/1_axes
89
+ python axes.py
90
+ ```
91
+
92
+ See [the developer setup guide](docs/reference/contribution/developer_env.md)
93
+ for formatting, type checking, packaging, and Docker instructions.
94
+
95
+ For private vulnerability reports and the supported-version policy, see
96
+ [SECURITY.md](SECURITY.md).
97
+
98
+ ## Authors
99
+
100
+ This repository was forked from code developed by Giordano Mattoni.
101
+
102
+ - Giordano Mattoni
103
+ - Soichiro Yamane
104
+
105
+ ## License
106
+
107
+ This project is distributed under the [MIT License](LICENSE).
@@ -1,6 +1,11 @@
1
1
  from .color.colormap import get_cmap
2
- from .config.config import (Config, config_dict, config_entry_option,
3
- config_load, save_metadata)
2
+ from .config.config import (
3
+ Config,
4
+ config_dict,
5
+ config_entry_option,
6
+ config_load,
7
+ save_metadata,
8
+ )
4
9
  from .data.load_file import load_file, load_file_fast
5
10
  from .figure.axes import axes
6
11
  from .figure.axes_inset import axes_inset, axes_inset_padding
@@ -14,12 +19,23 @@ from .plot.line_colormap_dashed import line_colormap_dashed
14
19
  from .plot.line_colormap_solid import line_colormap_solid
15
20
  from .plot.scatter import scatter
16
21
  from .plot.scatter_colormap import scatter_colormap
17
- from .style.graph import (graph_facecolor, graph_square, graph_square_axes,
18
- graph_transparent, graph_transparent_axes,
19
- graph_white, graph_white_axes)
22
+ from .style.graph import (
23
+ graph_facecolor,
24
+ graph_square,
25
+ graph_square_axes,
26
+ graph_transparent,
27
+ graph_transparent_axes,
28
+ graph_white,
29
+ graph_white_axes,
30
+ )
20
31
  from .style.label import label, label_add_index
21
- from .style.legend import (legend, legend_axes, legend_get_handlers,
22
- legend_handlers, legend_reverse)
32
+ from .style.legend import (
33
+ legend,
34
+ legend_axes,
35
+ legend_get_handlers,
36
+ legend_handlers,
37
+ legend_reverse,
38
+ )
23
39
  from .style.legend_colormap import legend_colormap
24
40
  from .style.ticks import ticks_off, ticks_on, ticks_on_axes
25
41
  from .style.title import title, title_axes
@@ -63,7 +63,7 @@ class Config:
63
63
  Methods
64
64
  --------------------
65
65
  load(config_path=None)
66
- Loads configuration data from a specified path or reloads the default configuration.
66
+ Loads configuration data from a specified path or searches the default locations again.
67
67
  get_config_entry_option(key)
68
68
  Retrieves a specific entry from the configuration dictionary based on the provided key.
69
69
 
@@ -129,12 +129,12 @@ class Config:
129
129
 
130
130
  def load(self, config_path: str | None = None) -> dict[str, Any]:
131
131
  """
132
- Loads configuration data from a file or reloads the current configuration.
132
+ Loads configuration data from a file or searches the default locations again.
133
133
 
134
134
  Parameters
135
135
  --------------------
136
136
  config_path : str or None, optional
137
- The path to the configuration file. If `None`, reloads the existing configuration (default is None).
137
+ The path to the configuration file. If `None`, searches the default locations again (default is None).
138
138
 
139
139
  Returns
140
140
  --------------------
@@ -149,9 +149,7 @@ class Config:
149
149
  {'setting1': 'value1', 'setting2': 'value2'}
150
150
  """
151
151
  loader: ConfigLoad = ConfigLoad(config_path)
152
- config_dict: dict[str, Any] = (
153
- loader.init_load() if config_path else loader.get_config()
154
- )
152
+ config_dict: dict[str, Any] = loader.init_load()
155
153
  self.config_dict = config_dict
156
154
 
157
155
  # Save metadata
@@ -322,10 +320,14 @@ class ConfigLoad:
322
320
  >>> rc_params = {"figure.dpi": 100, "backend": "TkAgg"}
323
321
  >>> ConfigLoad.apply_rc_params(rc_params)
324
322
  """
325
- backend = rc_params.pop("backends", None)
323
+ params = dict(rc_params)
324
+ backend = params.pop("backend", None)
325
+ if backend is None:
326
+ # Keep accepting the historical plural spelling in existing files.
327
+ backend = params.pop("backends", None)
326
328
  if backend:
327
- mpl.use(backend)
328
- rcParams.update(rc_params)
329
+ mpl.use(str(backend))
330
+ rcParams.update(cast(Any, params))
329
331
 
330
332
  def get_config(self) -> dict[str, Any]:
331
333
  """
@@ -346,13 +348,13 @@ class ConfigLoad:
346
348
  """
347
349
  if not self.config_path:
348
350
  return {}
349
- with open(self.config_path, "r") as f:
351
+ with open(self.config_path, "r", encoding="utf-8") as f:
350
352
  return cast(dict[str, Any], json.load(f))
351
353
 
352
354
 
353
355
  def config_load(config_path: str | None = None) -> dict[str, Any]:
354
356
  """
355
- Loads the configuration data from a specified file or reloads the existing configuration.
357
+ Loads configuration data from a specified file or searches the default locations again.
356
358
 
357
359
  This function initializes the `Config` singleton, loads the configuration file,
358
360
  and returns the loaded configuration dictionary.
@@ -360,7 +362,7 @@ def config_load(config_path: str | None = None) -> dict[str, Any]:
360
362
  Parameters
361
363
  --------------------
362
364
  config_path : str or None, optional
363
- The path to the configuration file. If `None`, the existing configuration is reloaded (default is None).
365
+ The path to the configuration file. If `None`, the default locations are searched again (default is None).
364
366
 
365
367
  Returns
366
368
  --------------------
@@ -1,6 +1,6 @@
1
1
  from collections.abc import Hashable
2
2
  from enum import Enum
3
- from typing import Any, Generic, Literal, TypeVar
3
+ from typing import Any, Generic, Literal, TypeVar, cast
4
4
 
5
5
  import matplotlib.pyplot as plt
6
6
  from matplotlib.axes import Axes
@@ -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()
@@ -243,7 +240,7 @@ class AxesHandler(Generic[_T]):
243
240
  list of matplotlib.axes.Axes
244
241
  A list of axes in the current figure.
245
242
  """
246
- return plt.gcf().axes
243
+ return cast(list[Axes], plt.gcf().axes)
247
244
 
248
245
  def create_figure(self) -> None:
249
246
  """
@@ -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
  """
@@ -3,8 +3,7 @@ from typing import Any, cast
3
3
  from matplotlib.axes import Axes
4
4
  from matplotlib.transforms import BboxBase, Transform, TransformedBbox
5
5
  from matplotlib.typing import ColorType
6
- from mpl_toolkits.axes_grid1.inset_locator import (BboxConnector, BboxPatch,
7
- inset_axes)
6
+ from mpl_toolkits.axes_grid1.inset_locator import BboxConnector, BboxPatch, inset_axes
8
7
 
9
8
  from ..base.base import CreateClassParams, ParamsGetter, bind_passed_params
10
9
  from ..style.label import Label
@@ -1,5 +1,5 @@
1
1
  import numbers
2
- from typing import Any
2
+ from typing import Any, cast
3
3
 
4
4
  import matplotlib.pyplot as plt
5
5
  import numpy as np
@@ -198,7 +198,7 @@ class Line:
198
198
  *self.args,
199
199
  **self.kwargs,
200
200
  )
201
- return _plot
201
+ return cast(list[Line2D], _plot)
202
202
 
203
203
 
204
204
  @bind_passed_params()
@@ -1,4 +1,5 @@
1
- from typing import Any
1
+ from collections.abc import Sequence
2
+ from typing import Any, cast
2
3
 
3
4
  import matplotlib.pyplot as plt
4
5
  import numpy as np
@@ -402,9 +403,10 @@ class LineColormapDashed:
402
403
  self.x_interpolated[idx_start : i + 1],
403
404
  self.y_interpolated[idx_start : i + 1],
404
405
  )
406
+ collection_segments = cast(Sequence[ArrayLike], segments.tolist())
405
407
 
406
408
  lc = LineCollection(
407
- segments.tolist(),
409
+ collection_segments,
408
410
  cmap=self.cmap,
409
411
  norm=norm,
410
412
  capstyle="projecting",
@@ -431,9 +433,10 @@ class LineColormapDashed:
431
433
  self.x_interpolated[idx_start:],
432
434
  self.y_interpolated[idx_start:],
433
435
  )
436
+ collection_segments = cast(Sequence[ArrayLike], segments.tolist())
434
437
 
435
438
  lc = LineCollection(
436
- segments.tolist(),
439
+ collection_segments,
437
440
  cmap=self.cmap,
438
441
  norm=norm,
439
442
  )
@@ -1,4 +1,5 @@
1
- from typing import Any
1
+ from collections.abc import Sequence
2
+ from typing import Any, cast
2
3
 
3
4
  import numpy as np
4
5
  from matplotlib.axes import Axes
@@ -182,9 +183,10 @@ class LineColormapSolid:
182
183
  self.x, self.y
183
184
  )
184
185
  norm = LineColormapBase()._create_cmap(self.cmapdata)
186
+ collection_segments = cast(Sequence[ArrayLike], segments.tolist())
185
187
 
186
188
  lc: LineCollection = LineCollection(
187
- segments.tolist(), cmap=self.cmap, norm=norm
189
+ collection_segments, cmap=self.cmap, norm=norm
188
190
  )
189
191
  lc.set_array(self.cmapdata)
190
192
  lc.set_linewidth(self.linewidth)
@@ -15,8 +15,11 @@ from rich.panel import Panel
15
15
  from rich.text import Text
16
16
 
17
17
  from ..base.base import CreateClassParams, ParamsGetter, bind_passed_params
18
- from ..figure.axes_range_base import (AxesRangeSingleton, AxisRangeController,
19
- AxisRangeManager)
18
+ from ..figure.axes_range_base import (
19
+ AxesRangeSingleton,
20
+ AxisRangeController,
21
+ AxisRangeManager,
22
+ )
20
23
  from .ticks import MinorTicksAxes
21
24
 
22
25
  __all__ = ["label", "label_add_index"]
@@ -758,8 +761,47 @@ class Label:
758
761
  ax, x_lab, y_lab, self.xpad_label, self.ypad_label, **self.kwargs
759
762
  )
760
763
 
761
- # Configure axis limits and scales
762
- self.configure_axis_limits(ax, lims, final_axes_ranges)
764
+ # Configure axis limits and scales if not polar axis
765
+ if not ax.name.startswith("polar"):
766
+ self.configure_axis_limits(ax, lims, final_axes_ranges)
767
+ else:
768
+ self._configure_polar_axis(ax, x_lab, y_lab, lims)
769
+
770
+ def _configure_polar_axis(
771
+ self, ax: Axes, x_lab: str, y_lab: str, lims: list
772
+ ) -> None:
773
+ """
774
+ Configures labels and limits for a polar axis.
775
+ Parameters
776
+ --------------------
777
+ ax : Axes
778
+ The polar axis to configure.
779
+ x_lab : str
780
+ The label for the x-axis (theta).
781
+ y_lab : str
782
+ The label for the y-axis (r).
783
+ lims : list
784
+ The limits for the polar axis, where lims[0] is theta limits and lims[1] is r limits.
785
+ Returns
786
+ --------------------
787
+ None
788
+ """
789
+ # Set labels for polar axis
790
+ ax.set_xlabel(x_lab, labelpad=self.xpad_label, **self.kwargs)
791
+ ax.set_ylabel(y_lab, labelpad=self.ypad_label, **self.kwargs)
792
+ # Set limits for polar axis: theta
793
+ # check if component is a number
794
+ if isinstance(lims[0][0], (int, float)) and isinstance(
795
+ lims[0][1], (int, float)
796
+ ):
797
+ ax.set_thetamin(lims[0][0]) # type: ignore # mypy-ignore[no-untyped-call]
798
+ ax.set_thetamax(lims[0][1]) # type: ignore # mypy-ignore[no-untyped-call]
799
+ # Set limits for polar axis: r
800
+ if isinstance(lims[1][0], (int, float)) and isinstance(
801
+ lims[1][1], (int, float)
802
+ ):
803
+ ax.set_rmin(lims[1][0]) # type: ignore # mypy-ignore[no-untyped-call]
804
+ ax.set_rmax(lims[1][1]) # type: ignore # mypy-ignore[no-untyped-call]
763
805
 
764
806
  def _calculate_padding_range(self, range: NDArray[Any]) -> NDArray[Any]:
765
807
  """
@@ -0,0 +1,2 @@
1
+ __version__ = '0.3.0'
2
+ __commit__ = 'cf398e2eb5504c82b2ebb705db10800af33a4270'
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "gsplot"
3
3
 
4
- version = "0.1.4"
4
+ version = "0.3.0"
5
5
 
6
6
  description = "General-scientific plot based on matplotlib"
7
7
  authors = [
@@ -24,21 +24,23 @@ types-pyyaml = ">=6.0.12.20240917"
24
24
 
25
25
  [tool.poetry.group.dev.dependencies]
26
26
  flake8 = "^7.0.0"
27
- black = "^24.4.2"
28
- pre-commit = "^3.7.1"
29
- furo = "^2024.5.6"
27
+ black = ">=26.3.1,<27.0.0"
28
+ isort = ">=5.13.2,<9.0.0"
29
+ pre-commit = "^4.6.1"
30
+ furo = "^2025.12.19"
30
31
  myst-parser = "^4.0.0"
31
32
  pytest-watch = "^4.2.0"
32
- pytest = "^8.3.4"
33
+ pytest = ">=9.0.3,<10.0.0"
33
34
  pyright = "^1.1.390"
34
- mypy = "^1.13.0"
35
- sphinxext-opengraph = "^0.9.1"
35
+ mypy = "^2.3.0"
36
+ pip-audit = { version = ">=2.10.1,<3.0.0", python = ">=3.10,<4.0" }
37
+ sphinxext-opengraph = "^0.13.0"
36
38
  sphinx-pyscript = "^0.1.0"
37
39
  sphinx-tippy = "^0.4.3"
38
- sphinx-togglebutton = "^0.3.2"
40
+ sphinx-togglebutton = "^0.4.5"
39
41
  sphinx-design = "^0.6.1"
40
- sphinxcontrib-mermaid = "^1.0.0"
41
- pydata-sphinx-theme = "^0.16.0"
42
+ sphinxcontrib-mermaid = "^2.1.0"
43
+ pydata-sphinx-theme = "^0.19.0"
42
44
  sphinx-copybutton = "^0.5.2"
43
45
  sphinx-autobuild = "^2024.10.3"
44
46
  sphinx-multiversion = "^0.2.4"
@@ -47,3 +49,12 @@ sphinx-multiversion = "^0.2.4"
47
49
  [build-system]
48
50
  requires = ["poetry-core"]
49
51
  build-backend = "poetry.core.masonry.api"
52
+
53
+ [tool.black]
54
+ extend-exclude = "gsplot/version.py"
55
+
56
+ [tool.isort]
57
+ profile = "black"
58
+
59
+ [tool.pytest.ini_options]
60
+ testpaths = ["tests"]
gsplot-0.1.4/PKG-INFO DELETED
@@ -1,83 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: gsplot
3
- Version: 0.1.4
4
- Summary: General-scientific plot based on matplotlib
5
- Author: Giordano Mattoni
6
- Author-email: mattoni@scphys.kyoto-u.ac.jp
7
- Requires-Python: >=3.10
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
- Classifier: Programming Language :: Python :: 3.11
11
- Classifier: Programming Language :: Python :: 3.12
12
- Classifier: Programming Language :: Python :: 3.13
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
- Project-URL: Homepage, https://soichiroyamane.github.io/gsplot/
19
- Description-Content-Type: text/markdown
20
-
21
- <div align="center">
22
- <img src="docs/_static/logo/logo_title_gsplot.png" alt="logo_gsplot" width="300">
23
- </div>
24
-
25
- [![GitHub Page](https://github.com/SoichiroYamane/gsplot/actions/workflows/gh-pages-sphinx.yml/badge.svg)](https://github.com/SoichiroYamane/gsplot/actions/workflows/gh-pages-sphinx.yml)
26
- ![Using Poetry](https://img.shields.io/badge/Using-Poetry-blue)
27
- ![PyPI](https://img.shields.io/pypi/v/gsplot)
28
- ![PyPI - Downloads](https://img.shields.io/pypi/dm/gsplot)
29
- [![PyPI Downloads](https://static.pepy.tech/badge/gsplot)](https://pepy.tech/projects/gsplot)
30
- ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
31
- ![License: MIT](https://img.shields.io/badge/License-MIT-green)
32
-
33
- ----------------
34
-
35
- <p align="center" style="font-weight: bold; font-size: 1.2em; margin: 20px 0;">
36
- <a href="https://soichiroyamane.github.io/gsplot/stable" style="text-decoration: none;">Docs</a> |
37
- <a href="#authors" style="text-decoration: none;">Authors</a> |
38
- <a href="#license" style="text-decoration: none;">License</a>
39
- </p>
40
-
41
- 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.
42
-
43
- > [!WARNING]
44
- > This package is _beta_ quality. Expect breaking changes and many bugs 🐛. Please report any issue you encounter 🤝.
45
-
46
- ## ✨ Features
47
-
48
- - **Better Plot, Less Effort**: Effortlessly create high-quality figures ⚛️
49
- - **Compatibility**: Fully compatible with [matplotlib](https://matplotlib.org) 📊
50
- - **Customization**: Tailor configurations to suit your needs 🎨
51
- - **Reproducibility**: Save package states for reproducible plots 📦
52
-
53
- ### 📈 Example using gsplot
54
-
55
- [See more details](https://soichiroyamane.github.io/gsplot/stable/guides/demo/4_paper_plot.html)
56
-
57
- ![example](docs/_static/tutorial/SC_cal.png)
58
-
59
- ### 🌃 Example with Python REPL 🐍 and neovim 🌟
60
-
61
- [See more details](https://soichiroyamane.github.io/gsplot/stable/guides/demo/13_REPL.html)
62
-
63
- ![repl_tutorial](./docs/_static/tutorial/repl_tutorial_45fps.gif)
64
-
65
- ## 🚀 Getting Started
66
-
67
- To use **gsplot**, ensure that you have `Python 3.10+` installed. You can install the package using `pip`:
68
-
69
- ```bash
70
- pip install gsplot
71
- ```
72
-
73
- ## 👥 Authors
74
-
75
- This repository was forked from codes developed by Giordano Mattoni.
76
-
77
- - Giordano Mattoni
78
- - Soichiro Yamane
79
-
80
- ## 📜 License
81
-
82
- This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
83
-
gsplot-0.1.4/README.md DELETED
@@ -1,62 +0,0 @@
1
- <div align="center">
2
- <img src="docs/_static/logo/logo_title_gsplot.png" alt="logo_gsplot" width="300">
3
- </div>
4
-
5
- [![GitHub Page](https://github.com/SoichiroYamane/gsplot/actions/workflows/gh-pages-sphinx.yml/badge.svg)](https://github.com/SoichiroYamane/gsplot/actions/workflows/gh-pages-sphinx.yml)
6
- ![Using Poetry](https://img.shields.io/badge/Using-Poetry-blue)
7
- ![PyPI](https://img.shields.io/pypi/v/gsplot)
8
- ![PyPI - Downloads](https://img.shields.io/pypi/dm/gsplot)
9
- [![PyPI Downloads](https://static.pepy.tech/badge/gsplot)](https://pepy.tech/projects/gsplot)
10
- ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
11
- ![License: MIT](https://img.shields.io/badge/License-MIT-green)
12
-
13
- ----------------
14
-
15
- <p align="center" style="font-weight: bold; font-size: 1.2em; margin: 20px 0;">
16
- <a href="https://soichiroyamane.github.io/gsplot/stable" style="text-decoration: none;">Docs</a> |
17
- <a href="#authors" style="text-decoration: none;">Authors</a> |
18
- <a href="#license" style="text-decoration: none;">License</a>
19
- </p>
20
-
21
- 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.
22
-
23
- > [!WARNING]
24
- > This package is _beta_ quality. Expect breaking changes and many bugs 🐛. Please report any issue you encounter 🤝.
25
-
26
- ## ✨ Features
27
-
28
- - **Better Plot, Less Effort**: Effortlessly create high-quality figures ⚛️
29
- - **Compatibility**: Fully compatible with [matplotlib](https://matplotlib.org) 📊
30
- - **Customization**: Tailor configurations to suit your needs 🎨
31
- - **Reproducibility**: Save package states for reproducible plots 📦
32
-
33
- ### 📈 Example using gsplot
34
-
35
- [See more details](https://soichiroyamane.github.io/gsplot/stable/guides/demo/4_paper_plot.html)
36
-
37
- ![example](docs/_static/tutorial/SC_cal.png)
38
-
39
- ### 🌃 Example with Python REPL 🐍 and neovim 🌟
40
-
41
- [See more details](https://soichiroyamane.github.io/gsplot/stable/guides/demo/13_REPL.html)
42
-
43
- ![repl_tutorial](./docs/_static/tutorial/repl_tutorial_45fps.gif)
44
-
45
- ## 🚀 Getting Started
46
-
47
- To use **gsplot**, ensure that you have `Python 3.10+` installed. You can install the package using `pip`:
48
-
49
- ```bash
50
- pip install gsplot
51
- ```
52
-
53
- ## 👥 Authors
54
-
55
- This repository was forked from codes developed by Giordano Mattoni.
56
-
57
- - Giordano Mattoni
58
- - Soichiro Yamane
59
-
60
- ## 📜 License
61
-
62
- This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
@@ -1,2 +0,0 @@
1
- __version__ = '0.1.4'
2
- __commit__ = '0a12f2e70bdfc952f9e6467e52fdd60e56412894'
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