gsplot 0.0.3__tar.gz → 0.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {gsplot-0.0.3 → gsplot-0.0.4}/LICENSE +1 -1
  2. {gsplot-0.0.3 → gsplot-0.0.4}/PKG-INFO +16 -19
  3. {gsplot-0.0.3 → gsplot-0.0.4}/README.md +15 -18
  4. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/figure/axes.py +2 -2
  5. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/figure/axes_base.py +6 -2
  6. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/style/label.py +11 -6
  7. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/style/ticks.py +8 -8
  8. gsplot-0.0.4/gsplot/version.py +2 -0
  9. {gsplot-0.0.3 → gsplot-0.0.4}/pyproject.toml +4 -1
  10. gsplot-0.0.3/gsplot/version.py +0 -2
  11. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/__init__.py +0 -0
  12. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/base/base.py +0 -0
  13. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/base/base_alias_validator.py +0 -0
  14. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/color/colormap.py +0 -0
  15. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/config/config.py +0 -0
  16. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/data/load_file.py +0 -0
  17. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/figure/figure_tools.py +0 -0
  18. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/figure/show.py +0 -0
  19. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/figure/store.py +0 -0
  20. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/hello_world/hello_world.py +0 -0
  21. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/logger.py +0 -0
  22. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/path/path.py +0 -0
  23. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/plot/line.py +0 -0
  24. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/plot/line_base.py +0 -0
  25. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/plot/line_colormap_base.py +0 -0
  26. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/plot/line_colormap_dashed.py +0 -0
  27. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/plot/line_colormap_solid.py +0 -0
  28. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/plot/scatter.py +0 -0
  29. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/plot/scatter_colormap.py +0 -0
  30. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/style/graph.py +0 -0
  31. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/style/legend.py +0 -0
  32. {gsplot-0.0.3 → gsplot-0.0.4}/gsplot/style/legend_colormap.py +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Soichiro Yamane
3
+ Copyright (c) 2024 Giordano Mattoni and Soichiro Yamane
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gsplot
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: General-scientific plot based on matplotlib
5
5
  Author: Giordano Mattoni
6
6
  Author-email: mattoni@scphys.kyoto-u.ac.jp
@@ -18,15 +18,17 @@ Requires-Dist: types-pyyaml (>=6.0.12.20240917,<7.0.0.0)
18
18
  Project-URL: Homepage, https://soichiroyamane.github.io/gsplot/
19
19
  Description-Content-Type: text/markdown
20
20
 
21
- # gsplot 📈
22
-
23
21
  <div align="center">
24
- <img src="docs/_static/logo_gsplot.svg" alt="logo_gsplot" width="100">
22
+ <img src="docs/_static/logo/logo_title_gsplot.png" alt="logo_gsplot" width="300">
25
23
  </div>
26
24
 
27
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)
28
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/:packageName)
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
29
  ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
30
+ ![License: MIT](https://img.shields.io/badge/License-MIT-green)
31
+
30
32
  ----------------
31
33
 
32
34
  <p align="center" style="font-weight: bold; font-size: 1.2em; margin: 20px 0;">
@@ -37,46 +39,41 @@ Description-Content-Type: text/markdown
37
39
 
38
40
  Welcome to **gsplot** (general-scientific plot), a toolkit designed to enhance the 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.
39
41
 
40
- ## Features
42
+ ## Features
41
43
 
42
- - **Better Plot, Less Code**: Simplify the process of creating high-quality figures 💤
44
+ - **Better Plot, Less Code**: Simplify the process of creating high-quality figures ⚛️
43
45
  - **Compatibility**: Compatible with [matplotlib](https://matplotlib.org) 📊
44
46
  - **Customization**: Customize your configuration to fit your needs 🎨
45
47
  - **Reproducibility**: Save your package status to make plots reproducible 📦
46
48
 
47
- ### Example using gsplot 📈
49
+ ### 📈 Example using gsplot
48
50
 
49
51
  [See more details](https://soichiroyamane.github.io/gsplot/guides/demo/4_paper_plot.html)
50
52
 
51
- ![example](demo/4_paper_plot/SC_cal.png)
53
+ ![example](docs/_static/tutorial/SC_cal.png)
52
54
 
53
- ### Example with Python REPL 🐍 and neovim 🌟
55
+ ### 🌃 Example with Python REPL 🐍 and neovim 🌟
54
56
 
55
57
  [See more details](https://soichiroyamane.github.io/gsplot/guides/demo/13_REPL.html)
56
- ![repl_tutorial](./docs/_static/repl_tutorial_sp.gif)
57
58
 
58
- ## Getting Started 🚀
59
+ ![repl_tutorial](./docs/_static/tutorial/repl_tutorial_sp.gif)
59
60
 
60
- ### Installation
61
+ ## 🚀 Getting Started
61
62
 
62
63
  To use **gsplot**, ensure that you have `Python 3.10+` installed. You can install the package using `pip`:
63
64
 
64
- #### important
65
-
66
- **⚠️ This package has not been published yet**
67
-
68
65
  ```bash
69
66
  pip install gsplot
70
67
  ```
71
68
 
72
- ## Authors 👥
69
+ ## 👥 Authors
73
70
 
74
71
  This repository was forked from codes developed by Giordano Mattoni.
75
72
 
76
73
  - Giordano Mattoni
77
74
  - Soichiro Yamane
78
75
 
79
- ## License 📜
76
+ ## 📜 License
80
77
 
81
78
  This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
82
79
 
@@ -1,12 +1,14 @@
1
- # gsplot 📈
2
-
3
1
  <div align="center">
4
- <img src="docs/_static/logo_gsplot.svg" alt="logo_gsplot" width="100">
2
+ <img src="docs/_static/logo/logo_title_gsplot.png" alt="logo_gsplot" width="300">
5
3
  </div>
6
4
 
7
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)
8
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/:packageName)
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
9
  ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
10
+ ![License: MIT](https://img.shields.io/badge/License-MIT-green)
11
+
10
12
  ----------------
11
13
 
12
14
  <p align="center" style="font-weight: bold; font-size: 1.2em; margin: 20px 0;">
@@ -17,45 +19,40 @@
17
19
 
18
20
  Welcome to **gsplot** (general-scientific plot), a toolkit designed to enhance the 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.
19
21
 
20
- ## Features
22
+ ## Features
21
23
 
22
- - **Better Plot, Less Code**: Simplify the process of creating high-quality figures 💤
24
+ - **Better Plot, Less Code**: Simplify the process of creating high-quality figures ⚛️
23
25
  - **Compatibility**: Compatible with [matplotlib](https://matplotlib.org) 📊
24
26
  - **Customization**: Customize your configuration to fit your needs 🎨
25
27
  - **Reproducibility**: Save your package status to make plots reproducible 📦
26
28
 
27
- ### Example using gsplot 📈
29
+ ### 📈 Example using gsplot
28
30
 
29
31
  [See more details](https://soichiroyamane.github.io/gsplot/guides/demo/4_paper_plot.html)
30
32
 
31
- ![example](demo/4_paper_plot/SC_cal.png)
33
+ ![example](docs/_static/tutorial/SC_cal.png)
32
34
 
33
- ### Example with Python REPL 🐍 and neovim 🌟
35
+ ### 🌃 Example with Python REPL 🐍 and neovim 🌟
34
36
 
35
37
  [See more details](https://soichiroyamane.github.io/gsplot/guides/demo/13_REPL.html)
36
- ![repl_tutorial](./docs/_static/repl_tutorial_sp.gif)
37
38
 
38
- ## Getting Started 🚀
39
+ ![repl_tutorial](./docs/_static/tutorial/repl_tutorial_sp.gif)
39
40
 
40
- ### Installation
41
+ ## 🚀 Getting Started
41
42
 
42
43
  To use **gsplot**, ensure that you have `Python 3.10+` installed. You can install the package using `pip`:
43
44
 
44
- #### important
45
-
46
- **⚠️ This package has not been published yet**
47
-
48
45
  ```bash
49
46
  pip install gsplot
50
47
  ```
51
48
 
52
- ## Authors 👥
49
+ ## 👥 Authors
53
50
 
54
51
  This repository was forked from codes developed by Giordano Mattoni.
55
52
 
56
53
  - Giordano Mattoni
57
54
  - Soichiro Yamane
58
55
 
59
- ## License 📜
56
+ ## 📜 License
60
57
 
61
58
  This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
@@ -171,7 +171,7 @@ class AxesHandler(Generic[_T]):
171
171
  Indicates whether shared storage is used.
172
172
  size : list of int or float
173
173
  The size of the figure in the specified unit.
174
- unit : Literal["mm", "cm", "in", "pt"]
174
+ unit : {"mm", "cm", "in", "pt"}
175
175
  The unit for the figure size.
176
176
  mosaic : str or list of HashableList[_T] or list of HashableList[Hashable]
177
177
  The mosaic layout for subplots.
@@ -312,7 +312,7 @@ def axes(
312
312
  Whether to use a shared storage for axes or figure states (default is False).
313
313
  size : list of int or float, optional
314
314
  The size of the figure in the specified unit (default is [5, 5]).
315
- unit : Literal["mm", "cm", "in", "pt"], optional
315
+ unit : {"mm", "cm", "in", "pt"}, optional
316
316
  The unit for the figure size. Supported units are "mm", "cm", "in", and "pt" (default is "in").
317
317
  mosaic : str or list of HashableList[_T] or list of HashableList[Hashable], optional
318
318
  The mosaic layout for subplots. Can be a string or a list of hashable items (default is "A").
@@ -105,10 +105,14 @@ class AxesResolver:
105
105
  except IndexError:
106
106
  error_message = f"Axes out of range: {self._axis_index} => Number of axes: {len(axes)}, but requested {ordinal_suffix(self._axis_index + 1)} axis."
107
107
  raise IndexError(error_message)
108
-
109
108
  elif isinstance(self.axis_target, Axes):
110
109
  self._axis = self.axis_target
111
- self._axis_index = plt.gcf().axes.index(self._axis)
110
+ if self.axis_target in plt.gcf().axes:
111
+ self._axis_index = plt.gcf().axes.index(self._axis)
112
+ else:
113
+ # Add the axis to the current figure if it is not present
114
+ plt.gcf().add_axes(self._axis)
115
+ self._axis_index = len(plt.gcf().axes) - 1
112
116
  else:
113
117
  raise ValueError(
114
118
  "Invalid axis target. Please provide an integer or Axes object."
@@ -1,3 +1,4 @@
1
+ import warnings
1
2
  from functools import wraps
2
3
  from typing import Any, Callable, Literal, TypeVar, cast
3
4
 
@@ -778,12 +779,16 @@ class Label:
778
779
  def apply_tight_layout(self) -> None:
779
780
 
780
781
  if self.tight_layout:
781
- try:
782
- plt.tight_layout(
783
- w_pad=self.x_pad, h_pad=self.y_pad, *self.args, **self.kwargs
784
- )
785
- except Exception:
786
- plt.tight_layout(w_pad=self.x_pad, h_pad=self.y_pad)
782
+ # Ignore this warning when using inset_axes:
783
+ # UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect
784
+ with warnings.catch_warnings():
785
+ warnings.simplefilter("ignore")
786
+ try:
787
+ plt.tight_layout(
788
+ w_pad=self.x_pad, h_pad=self.y_pad, *self.args, **self.kwargs
789
+ )
790
+ except Exception:
791
+ plt.tight_layout(w_pad=self.x_pad, h_pad=self.y_pad)
787
792
 
788
793
  def label(self) -> None:
789
794
 
@@ -47,13 +47,13 @@ class MinorTicks:
47
47
  self.axis_index: int = _axes_resolver.axis_index
48
48
  self.axis: Axes = _axes_resolver.axis
49
49
 
50
- def set_minor_ticks_off(self, mode=Literal["x", "y", "xy"]) -> None:
50
+ def set_minor_ticks_off(self, mode: Literal["x", "y", "xy"] = "xy") -> None:
51
51
  """
52
52
  Turn off minor ticks for the specified axis.
53
53
 
54
54
  Parameters
55
55
  --------------------
56
- mode : Literal["x", "y", "xy"], optional
56
+ mode : {"x", "y", "xy"}, optional
57
57
  Specifies the axis to configure. 'x' for x-axis, 'y' for y-axis,
58
58
  and 'xy' for both axes. Default is 'xy'.
59
59
  """
@@ -67,13 +67,13 @@ class MinorTicks:
67
67
  else:
68
68
  raise ValueError("Invalid mode. Choose from 'x', 'y', or 'xy'.")
69
69
 
70
- def set_minor_ticks_on(self, mode=Literal["x", "y", "xy"]) -> None:
70
+ def set_minor_ticks_on(self, mode: Literal["x", "y", "xy"] = "xy") -> None:
71
71
  """
72
72
  Turn on minor ticks for the specified axis.
73
73
 
74
74
  Parameters
75
75
  --------------------
76
- mode : Literal["x", "y", "xy"], optional
76
+ mode : {"x", "y", "xy"}, optional
77
77
  Specifies the axis to configure. 'x' for x-axis, 'y' for y-axis,
78
78
  and 'xy' for both axes. Default is 'xy'.
79
79
  """
@@ -112,7 +112,7 @@ class MinorTicksAxes:
112
112
  axis.yaxis.set_minor_locator(plticker.AutoMinorLocator())
113
113
 
114
114
 
115
- def ticks_off(axis_target: int | Axes, mode=Literal["x", "y", "xy"]) -> None:
115
+ def ticks_off(axis_target: int | Axes, mode: Literal["x", "y", "xy"] = "xy") -> None:
116
116
  """
117
117
  Turn off minor ticks for the specified axis.
118
118
 
@@ -120,7 +120,7 @@ def ticks_off(axis_target: int | Axes, mode=Literal["x", "y", "xy"]) -> None:
120
120
  --------------------
121
121
  axis_target : int | Axes
122
122
  The target axis for minor tick configuration.
123
- mode : Literal["x", "y", "xy"], optional
123
+ mode : {"x", "y", "xy"}, optional
124
124
  Specifies the axis to configure. 'x' for x-axis, 'y' for y-axis,
125
125
  and 'xy' for both axes. Default is 'xy'.
126
126
 
@@ -133,7 +133,7 @@ def ticks_off(axis_target: int | Axes, mode=Literal["x", "y", "xy"]) -> None:
133
133
  MinorTicks(axis_target).set_minor_ticks_off(mode)
134
134
 
135
135
 
136
- def ticks_on(axis_target: int | Axes, mode=Literal["x", "y", "xy"]) -> None:
136
+ def ticks_on(axis_target: int | Axes, mode: Literal["x", "y", "xy"] = "xy") -> None:
137
137
  """
138
138
  Turn on minor ticks for the specified axis.
139
139
 
@@ -141,7 +141,7 @@ def ticks_on(axis_target: int | Axes, mode=Literal["x", "y", "xy"]) -> None:
141
141
  --------------------
142
142
  axis_target : int | Axes
143
143
  The target axis for minor tick configuration.
144
- mode : Literal["x", "y", "xy"], optional
144
+ mode : {"x", "y", "xy"}, optional
145
145
  Specifies the axis to configure. 'x' for x-axis, 'y' for y-axis,
146
146
  and 'xy' for both axes. Default is 'xy'.
147
147
 
@@ -0,0 +1,2 @@
1
+ __version__ = '0.0.4'
2
+ __commit__ = 'b4abb098ff682226095e5a00ef7c66de4e55b589'
@@ -1,6 +1,8 @@
1
1
  [tool.poetry]
2
2
  name = "gsplot"
3
- version = "0.0.3"
3
+
4
+ version = "0.0.4"
5
+
4
6
  description = "General-scientific plot based on matplotlib"
5
7
  authors = [
6
8
  "Giordano Mattoni <mattoni@scphys.kyoto-u.ac.jp>",
@@ -39,6 +41,7 @@ sphinxcontrib-mermaid = "^1.0.0"
39
41
  pydata-sphinx-theme = "^0.16.0"
40
42
  sphinx-copybutton = "^0.5.2"
41
43
  sphinx-autobuild = "^2024.10.3"
44
+ sphinx-multiversion = "^0.2.4"
42
45
 
43
46
 
44
47
  [build-system]
@@ -1,2 +0,0 @@
1
- __version__ = "0.0.1"
2
- __commit__ = "e177e4ac05a803b519d30cdb803d87fefaa5dcac"
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