plotlp 0.1.0__tar.gz → 0.1.2__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.
@@ -1,39 +1,47 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: plotlp
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A library wrapper around matplotlib for custom plots.
5
- Author: LancelotPincet
6
- Author-email: LancelotPincet <40608570+LancelotPincet@users.noreply.github.com>
7
5
  Requires-Dist: corelp
8
- Requires-Dist: pytest>=8.4.1
9
- Requires-Dist: sphinx>=8.2.3
10
- Requires-Dist: sphinx-rtd-theme>=3.0.2
11
- Requires-Dist: toml>=0.10.2
6
+ Requires-Dist: cycler
7
+ Requires-Dist: ipykernel
8
+ Requires-Dist: matplotlib
9
+ Requires-Dist: pytest
10
+ Requires-Dist: sphinx
11
+ Requires-Dist: sphinx-design
12
+ Requires-Dist: sphinx-rtd-theme
13
+ Requires-Dist: spyder-kernels
14
+ Requires-Dist: toml
12
15
  Requires-Python: >=3.12
13
16
  Description-Content-Type: text/markdown
14
17
 
15
- # plotLP
16
-
17
- ```text
18
- Author : Lancelot PINCET
19
- GitHub : https://github.com/LancelotPincet/plotLP
20
- HTTPS : https://github.com/LancelotPincet/plotLP.git
21
- SSH : git@github.com:LancelotPincet/plotLP.git
22
- PyPI : https://pypi.org/project/plotLP
23
- Docs : https://plotLP.readthedocs.io
24
- ```
25
-
26
- **A library wrapper around matplotlib for custom plots.**
27
-
28
- plotLP is available on [PyPI](https://pypi.org/project/plotLP) for pip installs.
29
- For more information, do not hesitate to consult the [Documentation](https://plotLP.readthedocs.io).
30
-
31
- ---
32
-
33
- ## MIT License
34
-
35
- Intellectual property behind this Library is protected via an [MIT license](LICENSE). This means everyone can *freely* use it in a personnal, academic or commercial manner, if they **keep the copyright name** at the top of the codes.
36
-
37
- The library can be redistributed, *with or without modifications*, in open or closed projects. However the **MIT license must be conserved**. For example in a commercial closed project, this means the **copyright and license must be visible somewhere**, like in the documentation or credits.
38
-
39
- The license also explains that the **code performances are not warrantied**, and you are responsible for how you are using it. For more information on your rights and obligations please refer to [descriptive websites](https://en.wikipedia.org/wiki/MIT_License), or contact author for approvales.
18
+ # plotLP
19
+
20
+ ```text
21
+ Author : Lancelot PINCET
22
+ GitHub : https://github.com/LancelotPincet/plotLP
23
+ HTTPS : https://github.com/LancelotPincet/plotLP.git
24
+ SSH : git@github.com:LancelotPincet/plotLP.git
25
+ PyPI : https://pypi.org/project/plotLP
26
+ Docs : https://plotLP.readthedocs.io
27
+ ```
28
+
29
+ **A library wrapper around matplotlib for custom plots.**
30
+
31
+ plotLP is available on [PyPI](https://pypi.org/project/plotLP) for pip installs.
32
+ For more information, do not hesitate to consult the [Documentation](https://plotLP.readthedocs.io).
33
+
34
+ ---
35
+
36
+ ## MIT License
37
+
38
+ <details>
39
+ <summary>details</summary>
40
+
41
+ Intellectual property behind this Library is protected via an [MIT license](LICENSE). This means everyone can *freely* use it in a personnal, academic or commercial manner, if they **keep the copyright name** at the top of the codes.
42
+
43
+ The library can be redistributed, *with or without modifications*, in open or closed projects. However the **MIT license must be conserved**. For example in a commercial closed project, this means the **copyright and license must be visible somewhere**, like in the documentation or credits.
44
+
45
+ The license also explains that the **code performances are not warrantied**, and you are responsible for how you are using it. For more information on your rights and obligations please refer to [descriptive websites](https://en.wikipedia.org/wiki/MIT_License), or contact author for approvales.
46
+
47
+ </details>
@@ -1,25 +1,30 @@
1
- # plotLP
2
-
3
- ```text
4
- Author : Lancelot PINCET
5
- GitHub : https://github.com/LancelotPincet/plotLP
6
- HTTPS : https://github.com/LancelotPincet/plotLP.git
7
- SSH : git@github.com:LancelotPincet/plotLP.git
8
- PyPI : https://pypi.org/project/plotLP
9
- Docs : https://plotLP.readthedocs.io
10
- ```
11
-
12
- **A library wrapper around matplotlib for custom plots.**
13
-
14
- plotLP is available on [PyPI](https://pypi.org/project/plotLP) for pip installs.
15
- For more information, do not hesitate to consult the [Documentation](https://plotLP.readthedocs.io).
16
-
17
- ---
18
-
19
- ## MIT License
20
-
21
- Intellectual property behind this Library is protected via an [MIT license](LICENSE). This means everyone can *freely* use it in a personnal, academic or commercial manner, if they **keep the copyright name** at the top of the codes.
22
-
23
- The library can be redistributed, *with or without modifications*, in open or closed projects. However the **MIT license must be conserved**. For example in a commercial closed project, this means the **copyright and license must be visible somewhere**, like in the documentation or credits.
24
-
25
- The license also explains that the **code performances are not warrantied**, and you are responsible for how you are using it. For more information on your rights and obligations please refer to [descriptive websites](https://en.wikipedia.org/wiki/MIT_License), or contact author for approvales.
1
+ # plotLP
2
+
3
+ ```text
4
+ Author : Lancelot PINCET
5
+ GitHub : https://github.com/LancelotPincet/plotLP
6
+ HTTPS : https://github.com/LancelotPincet/plotLP.git
7
+ SSH : git@github.com:LancelotPincet/plotLP.git
8
+ PyPI : https://pypi.org/project/plotLP
9
+ Docs : https://plotLP.readthedocs.io
10
+ ```
11
+
12
+ **A library wrapper around matplotlib for custom plots.**
13
+
14
+ plotLP is available on [PyPI](https://pypi.org/project/plotLP) for pip installs.
15
+ For more information, do not hesitate to consult the [Documentation](https://plotLP.readthedocs.io).
16
+
17
+ ---
18
+
19
+ ## MIT License
20
+
21
+ <details>
22
+ <summary>details</summary>
23
+
24
+ Intellectual property behind this Library is protected via an [MIT license](LICENSE). This means everyone can *freely* use it in a personnal, academic or commercial manner, if they **keep the copyright name** at the top of the codes.
25
+
26
+ The library can be redistributed, *with or without modifications*, in open or closed projects. However the **MIT license must be conserved**. For example in a commercial closed project, this means the **copyright and license must be visible somewhere**, like in the documentation or credits.
27
+
28
+ The license also explains that the **code performances are not warrantied**, and you are responsible for how you are using it. For more information on your rights and obligations please refer to [descriptive websites](https://en.wikipedia.org/wiki/MIT_License), or contact author for approvales.
29
+
30
+ </details>
@@ -1,26 +1,17 @@
1
1
  [project]
2
2
  name = "plotlp"
3
- version = "0.1.0"
3
+ version = "0.1.2"
4
4
  description = "A library wrapper around matplotlib for custom plots."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
7
- dependencies = [
8
- "corelp",
9
- "pytest>=8.4.1",
10
- "sphinx>=8.2.3",
11
- "sphinx-rtd-theme>=3.0.2",
12
- "toml>=0.10.2",
13
- ]
14
- [[project.authors]]
15
- name = "LancelotPincet"
16
- email = "40608570+LancelotPincet@users.noreply.github.com"
7
+ dependencies = [ "corelp", "cycler", "ipykernel", "matplotlib", "pytest", "sphinx", "sphinx-design", "sphinx-rtd-theme", "spyder-kernels", "toml",]
17
8
 
18
9
  [build-system]
19
10
  requires = [ "uv_build>=0.8.8,<0.9.0",]
20
11
  build-backend = "uv_build"
21
12
 
22
- ["tool.uv"]
13
+ [tool.uv]
23
14
  required-environments = [ "sys_platform == 'linux' and platform_machine == 'x86_64'", "sys_platform == 'win32' and (platform_machine == 'AMD64' or platform_machine == 'x86_64')",]
24
15
 
25
- [tool.uv.sources]
26
- corelp = { workspace = true }
16
+ [tool.uv.sources.corelp]
17
+ workspace = true
@@ -1,23 +1,23 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- # Date : 2025-08-28
4
- # Author : Lancelot PINCET
5
- # GitHub : https://github.com/LancelotPincet
6
- # Library : plotLP
7
-
8
- """
9
- A library wrapper around matplotlib for custom plots.
10
- """
11
-
12
-
13
-
14
- # %% Lazy imports
15
- from corelp import getmodule
16
- __getattr__, __all__ = getmodule(__file__)
17
-
18
-
19
-
20
- # %% Test function run
21
- if __name__ == "__main__":
22
- from corelp import test
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2025-08-28
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : plotLP
7
+
8
+ """
9
+ A library wrapper around matplotlib for custom plots.
10
+ """
11
+
12
+
13
+
14
+ # %% Lazy imports
15
+ from corelp import getmodule
16
+ __getattr__, __all__ = getmodule(__file__)
17
+
18
+
19
+
20
+ # %% Test function run
21
+ if __name__ == "__main__":
22
+ from corelp import test
23
23
  test(__file__)
@@ -0,0 +1,132 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2025-11-17
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : plotLP
7
+ # Module : cmap
8
+
9
+ """
10
+ This module adds custom cmaps to matplotlib.
11
+ """
12
+
13
+
14
+
15
+ # %% Libraries
16
+ from corelp import selfkwargs, prop
17
+ from arrLP import normalize
18
+ from plotlp import color
19
+ from matplotlib.colors import LinearSegmentedColormap, to_rgba_array
20
+ import numpy as np
21
+ from scipy.special import erf,erfinv
22
+
23
+
24
+
25
+ # %% Function
26
+ def cmap(**kwargs) :
27
+ '''
28
+ This module adds custom cmaps to matplotlib.
29
+
30
+ Parameters
31
+ ----------
32
+ a : int or float
33
+ TODO.
34
+
35
+ Returns
36
+ -------
37
+ b : int or float
38
+ TODO.
39
+
40
+ Raises
41
+ ------
42
+ TypeError
43
+ TODO.
44
+
45
+ Examples
46
+ --------
47
+ >>> from plotlp import cmap
48
+ ...
49
+ >>> cmap() # TODO
50
+ '''
51
+
52
+ return None
53
+
54
+
55
+
56
+ class Cmap(LinearSegmentedColormap) :
57
+ name = 'cmapLP'
58
+
59
+ def __init__(self, **kwargs) :
60
+ selfkwargs(self,kwargs)
61
+ r, g, b, a = to_rgba_array(self.colors).T
62
+ nodes = self.nodes
63
+ cdict = {
64
+ "red": np.column_stack([nodes, r, r]),
65
+ "green": np.column_stack([nodes, g, g]),
66
+ "blue": np.column_stack([nodes, b, b]),
67
+ "alpha": np.column_stack([nodes, a, a]),
68
+ }
69
+ super().__init__(self.name,cdict)
70
+
71
+ _black = 'black'
72
+ @prop(variable=True)
73
+ def black(self) -> str :
74
+ if self._black is None :
75
+ return color(rgb=self(self.get_node(0.)))
76
+ return color(auto=self._black)
77
+
78
+ _white = 'white'
79
+ @prop(variable=True)
80
+ def white(self) -> str :
81
+ if self._white is None :
82
+ return color(rgb=self(self.get_node(1.)))
83
+ return color(auto=self._white)
84
+
85
+ _color = None
86
+ @prop(variable=True)
87
+ def color(self) :
88
+ if self._color is None :
89
+ return color(rgb=self(self.get_node(0.5)))
90
+ return color(auto=self._color)
91
+
92
+ _dark = None #dark color
93
+ @prop(variable=True)
94
+ def dark(self) -> str :
95
+ if self._dark is None :
96
+ return color(self(self.get_node(0.25)))
97
+ return color(self._dark)
98
+
99
+ _light = None #light color
100
+ @prop(variable=True)
101
+ def light(self) -> str :
102
+ if self._light is None :
103
+ return color(self(self.get_node(0.75)))
104
+ return color(self._light)
105
+
106
+ _colors = None #list of colors
107
+ @prop()
108
+ def colors(self) -> str :
109
+ return [self.black,self.dark,self.color,self.light,self.white]
110
+ @colors.setter
111
+ def colors(self, value) -> float :
112
+ self._colors = [color(auto=color) for color in value]
113
+ @property
114
+ def ncolors(self) :
115
+ return len(self.colors)
116
+
117
+ _nodes = None #nodes corresponding to colors
118
+ @prop()
119
+ def nodes(self) -> str :
120
+ nodes = np.linspace(0.,1.,self.ncolors)
121
+ return self.get_node(nodes)
122
+ nodebase = 0 #Base defining distribution of colors around center based on erf function, when approching 0 the function tends towards linear distribution
123
+ def get_node(self,node) :
124
+ if self.nodebase == 0 : return node
125
+ node = (erfinv(normalize(node,-erf(self.nodebase),erf(self.nodebase),offset=0,norm=1))/self.nodebase+1)/2
126
+ return (np.round(node * 1000)).astype(int)/1000
127
+
128
+
129
+ # %% Test function run
130
+ if __name__ == "__main__":
131
+ from corelp import test
132
+ test(__file__)
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2025-11-17
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : plotLP
7
+ # Module : cmap
8
+
9
+ """
10
+ This file allows to test cmap
11
+
12
+ cmap : This module adds custom cmaps to matplotlib.
13
+ """
14
+
15
+
16
+
17
+ # %% Libraries
18
+ from corelp import print, debug
19
+ import pytest
20
+ from plotlp import cmap
21
+ debug_folder = debug(__file__)
22
+
23
+
24
+
25
+ # %% Function test
26
+ def test_function() :
27
+ '''
28
+ Test cmap function
29
+ '''
30
+ print('Hello world!')
31
+
32
+
33
+
34
+ # %% Instance fixture
35
+ @pytest.fixture()
36
+ def instance() :
37
+ '''
38
+ Create a new instance at each test function
39
+ '''
40
+ return cmap()
41
+
42
+ def test_instance(instance) :
43
+ '''
44
+ Test on fixture
45
+ '''
46
+ pass
47
+
48
+
49
+ # %% Returns test
50
+ @pytest.mark.parametrize("args, kwargs, expected, message", [
51
+ #([], {}, None, ""),
52
+ ([], {}, None, ""),
53
+ ])
54
+ def test_returns(args, kwargs, expected, message) :
55
+ '''
56
+ Test cmap return values
57
+ '''
58
+ assert cmap(*args, **kwargs) == expected, message
59
+
60
+
61
+
62
+ # %% Error test
63
+ @pytest.mark.parametrize("args, kwargs, error, error_message", [
64
+ #([], {}, None, ""),
65
+ ([], {}, None, ""),
66
+ ])
67
+ def test_errors(args, kwargs, error, error_message) :
68
+ '''
69
+ Test cmap error values
70
+ '''
71
+ with pytest.raises(error, match=error_message) :
72
+ cmap(*args, **kwargs)
73
+
74
+
75
+
76
+ # %% Test function run
77
+ if __name__ == "__main__":
78
+ from corelp import test
79
+ test(__file__)