matplotlibx 0.1.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Igor Sokolov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,277 @@
1
+ Metadata-Version: 2.4
2
+ Name: matplotlibx
3
+ Version: 0.1.0
4
+ Summary: Enhanced Matplotlib wrapper with publication-quality styling and colorblind accessibility
5
+ Author-email: Igor Sokolov <sokolov.igor.ch@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/isokolov/pltx
8
+ Project-URL: Bug Tracker, https://github.com/isokolov/pltx/issues
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Topic :: Scientific/Engineering :: Visualization
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: matplotlib>=3.5.0
21
+ Requires-Dist: numpy>=1.20.0
22
+ Provides-Extra: all
23
+ Requires-Dist: seaborn>=0.11.0; extra == "all"
24
+ Dynamic: license-file
25
+
26
+ # pltx - Enhanced Matplotlib for Scientific Visualization
27
+
28
+ **A matplotlib wrapper with publication-quality styling and colorblind accessibility features.**
29
+
30
+
31
+ <img src="img/pltx.png" alt="pltx visualization" width="400">
32
+
33
+
34
+
35
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
36
+ <!-- [![License](https://img.shields.io/badge/license-APACHE-green.svg)](LICENSE) -->
37
+
38
+ ---
39
+
40
+ I got bored to always create some custom formatting for my plots, run into reviewers asking for improving readability.
41
+ I want just to import and use it with minor modifications. Here I made something one can install and have pretty looking plots ready to go (just some personal styling on top of matplotlib).
42
+
43
+
44
+ Credits to Mathieu Garrigues for Pasqal colormap.
45
+
46
+ ## Key Features
47
+
48
+ - **Colorblind Accessible** - Progressive line width variation distinguishes lines by thickness AND color
49
+ - **Journal-Ready Presets** - Nature, presentation, and poster styles in one function call
50
+ - **Line Visibility** - Optional outlines and centerlines for better contrast
51
+ - **Drop-in Replacement** - Works with all matplotlib plot types
52
+ - **Auto Color Cycling** - Intelligent palette management with intensity control
53
+
54
+ ## Example Gallery
55
+
56
+ <img src="img/showcase.png" alt="pltx visualization" width="600">
57
+
58
+
59
+ ## Quick Start
60
+
61
+ ```python
62
+ import pltx.pyplot as plt
63
+ import numpy as np
64
+
65
+ # Enable colorblind-friendly progressive widths
66
+ plt.initialize_style(
67
+ palette_name='pasqal',
68
+ vary_linewidth=True, # Lines get progressively thicker
69
+ linewidth_progression_factor=1.3 # 30% increase per line
70
+ )
71
+
72
+ # Plot with automatic styling
73
+ x = np.linspace(0, 10, 100)
74
+ for i in range(5):
75
+ plt.plot_styled(x, np.sin(x + i*0.5),
76
+ color_idx=i,
77
+ centerline=True, # Add thin line on top
78
+ label=f'Line {i+1}')
79
+
80
+ plt.setup_axis(xlabel='x', ylabel='y', grid=True)
81
+ plt.legend()
82
+ plt.savefig('plot.png', dpi=300)
83
+ ```
84
+
85
+ <img src="img/plot.png" alt="pltx visualization" width="600">
86
+
87
+ Some other examples of the colormaps for which you can use `examples/generate_readme_images.py` script.
88
+
89
+ <img src="img/pasqal_heatmaps.png" alt="pltx visualization" width="600">
90
+ <img src="img/pasqal_swatches.png" alt="pltx visualization" width="600">
91
+ <img src="img/pasqal_sine_cosine.png" alt="pltx visualization" width="600">
92
+
93
+
94
+ ## Installation
95
+
96
+ ```bash
97
+ pip install pltx
98
+
99
+ # With optional seaborn support for extended palettes
100
+ pip install pltx[all]
101
+ ```
102
+
103
+ ## Key Features in Detail
104
+
105
+ ### 1. Progressive Line Width (Colorblind Accessible)
106
+
107
+ Each line automatically gets thicker - distinguishable by both color and width:
108
+
109
+ ```python
110
+ plt.initialize_style(
111
+ vary_linewidth=True,
112
+ base_linewidth=2.0,
113
+ linewidth_progression_factor=1.3 # 1.2=gentle, 1.3=moderate, 1.5=strong
114
+ )
115
+ ```
116
+
117
+ **Result:** Line 0: 2.0pt -> Line 1: 2.6pt -> Line 2: 3.4pt -> Line 3: 4.4pt
118
+
119
+ ### 2. Line Enhancements
120
+
121
+ ```python
122
+ # Outline (thick line behind)
123
+ plt.plot_styled(x, y, color_idx=0, outline=True)
124
+
125
+ # Centerline (thin line on top)
126
+ plt.plot_styled(x, y, color_idx=0, centerline=True)
127
+
128
+ # Both (maximum contrast)
129
+ plt.plot_styled(x, y, color_idx=0, outline=True, centerline=True)
130
+ ```
131
+
132
+ ### 3. Journal Presets
133
+
134
+ ```python
135
+ from pltx.rcparams import apply_style_preset
136
+
137
+ apply_style_preset('nature') # Nature journal (Arial, 7-9pt, 3.5")
138
+ apply_style_preset('presentation') # Slides (16-18pt, thick lines)
139
+ apply_style_preset('poster') # Posters (24-28pt)
140
+ ```
141
+
142
+ ### 4. Works with All Plot Types
143
+
144
+ ```python
145
+ from pltx.colors import get_color
146
+
147
+ # Bar plots
148
+ colors = [get_color(i) for i in range(5)]
149
+ plt.bar(categories, values, color=colors)
150
+
151
+ # Scatter plots
152
+ plt.plot_styled(x, y, marker='o', linestyle='', color_idx=0)
153
+
154
+ # All matplotlib functions available!
155
+ ```
156
+
157
+ ## Real-World Example
158
+
159
+ ### Nature Journal Submission
160
+
161
+ ```python
162
+ from pltx.rcparams import apply_style_preset
163
+ import pltx.pyplot as plt
164
+
165
+ # Apply Nature style + accessibility
166
+ apply_style_preset('nature')
167
+ plt.initialize_style(
168
+ vary_linewidth=True,
169
+ base_linewidth=1.0,
170
+ linewidth_progression_factor=1.3
171
+ )
172
+
173
+ # Single column figure
174
+ fig, ax = plt.subplots(figsize=(3.5, 2.6))
175
+
176
+ for i in range(4):
177
+ plt.plot_styled(x, data[i],
178
+ color_idx=i,
179
+ centerline=True, # Better in print
180
+ label=labels[i])
181
+
182
+ plt.setup_axis(xlabel='Time (s)', ylabel='Amplitude (a.u.)')
183
+ plt.legend()
184
+ plt.savefig('figure1.pdf', dpi=300)
185
+ ```
186
+
187
+ ## Documentation
188
+
189
+ - **[FULL_DOCUMENTATION.md](FULL_DOCUMENTATION.md)** - Complete API reference and detailed guide
190
+ - **[examples/](examples/)** - Working examples (demo.py, showcase.py, simple_example.py)
191
+ - 12 test PDFs demonstrating all features
192
+
193
+ ## Quick Reference
194
+
195
+ | Feature | Command |
196
+ |---------|---------|
197
+ | Progressive width | `vary_linewidth=True` |
198
+ | Outline | `outline=True` |
199
+ | Centerline | `centerline=True` |
200
+ | Nature style | `apply_style_preset('nature')` |
201
+ | Color cycling | `color_idx=i` |
202
+ | Axis setup | `setup_axis(xlabel=..., ylabel=...)` |
203
+
204
+ ## Feature Comparison
205
+
206
+ | Feature | matplotlib | pltx |
207
+ |---------|-----------|------|
208
+ | Colorblind accessible | Manual | `vary_linewidth=True` |
209
+ | Line visibility | Complex code | `outline=True` |
210
+ | Journal styles | Research guidelines | One function call |
211
+ | Color palettes | Manual setup | Automatic |
212
+
213
+ ## Progressive Width Factors
214
+
215
+ | Factor | Increase | Best For |
216
+ |--------|----------|----------|
217
+ | 1.2 | 20% | 8-10 lines |
218
+ | 1.3 | 30% | 4-6 lines (DEFAULT) |
219
+ | 1.5 | 50% | 2-4 lines |
220
+
221
+ ## Style Presets
222
+
223
+ | Preset | Fonts | Figure Size | Use Case |
224
+ |--------|-------|-------------|----------|
225
+ | nature | 7-9pt | 3.5"x2.6" | Nature journal |
226
+ | presentation | 16-18pt | 10"x6" | Slides |
227
+ | poster | 24-28pt | 12"x8" | Posters |
228
+ | default | 12-13pt | 6"x4" | General |
229
+
230
+ ## Dependencies
231
+
232
+ **Required:**
233
+ - matplotlib >= 3.5.0
234
+ - numpy >= 1.20.0
235
+
236
+ **Optional:**
237
+ - seaborn >= 0.11.0 (for extended palettes; falls back to matplotlib colormaps)
238
+
239
+ ## Why pltx?
240
+
241
+ - **Accessible** - Works for colorblind viewers (~8% of males)
242
+ - **Publication-Ready** - Journal-specific presets
243
+ - **Easy to Use** - Drop-in replacement for matplotlib
244
+ - **Flexible** - Works with all plot types
245
+ - **Well-Documented** - Comprehensive guides and examples
246
+
247
+ ## Quick Tips
248
+
249
+ 1. **Always use** `vary_linewidth=True` for multi-line plots
250
+ 2. **Choose factor** based on number of lines (1.2 for many, 1.5 for few)
251
+ 3. **Test in grayscale** to verify accessibility
252
+ 4. **Use presets** to match your target medium
253
+ 5. **Combine features** for maximum effect
254
+
255
+ ## Testing
256
+
257
+ The package includes a comprehensive test suite using `pytest`.
258
+
259
+ ```bash
260
+ # Install test dependencies
261
+ pip install pytest
262
+
263
+ # Run all tests
264
+ pytest tests
265
+ ```
266
+
267
+ The test suite covers color palette logic, style initialization, enhanced plotting functions, and style context management.
268
+
269
+
270
+ ---
271
+
272
+ **Version:** 0.1.0
273
+ **Python:** 3.10+
274
+ **Created:** 2026-01-09
275
+ **Author:** Igor Sokolov
276
+
277
+ For complete documentation, see [FULL_DOCUMENTATION.md](FULL_DOCUMENTATION.md)
@@ -0,0 +1,252 @@
1
+ # pltx - Enhanced Matplotlib for Scientific Visualization
2
+
3
+ **A matplotlib wrapper with publication-quality styling and colorblind accessibility features.**
4
+
5
+
6
+ <img src="img/pltx.png" alt="pltx visualization" width="400">
7
+
8
+
9
+
10
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
11
+ <!-- [![License](https://img.shields.io/badge/license-APACHE-green.svg)](LICENSE) -->
12
+
13
+ ---
14
+
15
+ I got bored to always create some custom formatting for my plots, run into reviewers asking for improving readability.
16
+ I want just to import and use it with minor modifications. Here I made something one can install and have pretty looking plots ready to go (just some personal styling on top of matplotlib).
17
+
18
+
19
+ Credits to Mathieu Garrigues for Pasqal colormap.
20
+
21
+ ## Key Features
22
+
23
+ - **Colorblind Accessible** - Progressive line width variation distinguishes lines by thickness AND color
24
+ - **Journal-Ready Presets** - Nature, presentation, and poster styles in one function call
25
+ - **Line Visibility** - Optional outlines and centerlines for better contrast
26
+ - **Drop-in Replacement** - Works with all matplotlib plot types
27
+ - **Auto Color Cycling** - Intelligent palette management with intensity control
28
+
29
+ ## Example Gallery
30
+
31
+ <img src="img/showcase.png" alt="pltx visualization" width="600">
32
+
33
+
34
+ ## Quick Start
35
+
36
+ ```python
37
+ import pltx.pyplot as plt
38
+ import numpy as np
39
+
40
+ # Enable colorblind-friendly progressive widths
41
+ plt.initialize_style(
42
+ palette_name='pasqal',
43
+ vary_linewidth=True, # Lines get progressively thicker
44
+ linewidth_progression_factor=1.3 # 30% increase per line
45
+ )
46
+
47
+ # Plot with automatic styling
48
+ x = np.linspace(0, 10, 100)
49
+ for i in range(5):
50
+ plt.plot_styled(x, np.sin(x + i*0.5),
51
+ color_idx=i,
52
+ centerline=True, # Add thin line on top
53
+ label=f'Line {i+1}')
54
+
55
+ plt.setup_axis(xlabel='x', ylabel='y', grid=True)
56
+ plt.legend()
57
+ plt.savefig('plot.png', dpi=300)
58
+ ```
59
+
60
+ <img src="img/plot.png" alt="pltx visualization" width="600">
61
+
62
+ Some other examples of the colormaps for which you can use `examples/generate_readme_images.py` script.
63
+
64
+ <img src="img/pasqal_heatmaps.png" alt="pltx visualization" width="600">
65
+ <img src="img/pasqal_swatches.png" alt="pltx visualization" width="600">
66
+ <img src="img/pasqal_sine_cosine.png" alt="pltx visualization" width="600">
67
+
68
+
69
+ ## Installation
70
+
71
+ ```bash
72
+ pip install pltx
73
+
74
+ # With optional seaborn support for extended palettes
75
+ pip install pltx[all]
76
+ ```
77
+
78
+ ## Key Features in Detail
79
+
80
+ ### 1. Progressive Line Width (Colorblind Accessible)
81
+
82
+ Each line automatically gets thicker - distinguishable by both color and width:
83
+
84
+ ```python
85
+ plt.initialize_style(
86
+ vary_linewidth=True,
87
+ base_linewidth=2.0,
88
+ linewidth_progression_factor=1.3 # 1.2=gentle, 1.3=moderate, 1.5=strong
89
+ )
90
+ ```
91
+
92
+ **Result:** Line 0: 2.0pt -> Line 1: 2.6pt -> Line 2: 3.4pt -> Line 3: 4.4pt
93
+
94
+ ### 2. Line Enhancements
95
+
96
+ ```python
97
+ # Outline (thick line behind)
98
+ plt.plot_styled(x, y, color_idx=0, outline=True)
99
+
100
+ # Centerline (thin line on top)
101
+ plt.plot_styled(x, y, color_idx=0, centerline=True)
102
+
103
+ # Both (maximum contrast)
104
+ plt.plot_styled(x, y, color_idx=0, outline=True, centerline=True)
105
+ ```
106
+
107
+ ### 3. Journal Presets
108
+
109
+ ```python
110
+ from pltx.rcparams import apply_style_preset
111
+
112
+ apply_style_preset('nature') # Nature journal (Arial, 7-9pt, 3.5")
113
+ apply_style_preset('presentation') # Slides (16-18pt, thick lines)
114
+ apply_style_preset('poster') # Posters (24-28pt)
115
+ ```
116
+
117
+ ### 4. Works with All Plot Types
118
+
119
+ ```python
120
+ from pltx.colors import get_color
121
+
122
+ # Bar plots
123
+ colors = [get_color(i) for i in range(5)]
124
+ plt.bar(categories, values, color=colors)
125
+
126
+ # Scatter plots
127
+ plt.plot_styled(x, y, marker='o', linestyle='', color_idx=0)
128
+
129
+ # All matplotlib functions available!
130
+ ```
131
+
132
+ ## Real-World Example
133
+
134
+ ### Nature Journal Submission
135
+
136
+ ```python
137
+ from pltx.rcparams import apply_style_preset
138
+ import pltx.pyplot as plt
139
+
140
+ # Apply Nature style + accessibility
141
+ apply_style_preset('nature')
142
+ plt.initialize_style(
143
+ vary_linewidth=True,
144
+ base_linewidth=1.0,
145
+ linewidth_progression_factor=1.3
146
+ )
147
+
148
+ # Single column figure
149
+ fig, ax = plt.subplots(figsize=(3.5, 2.6))
150
+
151
+ for i in range(4):
152
+ plt.plot_styled(x, data[i],
153
+ color_idx=i,
154
+ centerline=True, # Better in print
155
+ label=labels[i])
156
+
157
+ plt.setup_axis(xlabel='Time (s)', ylabel='Amplitude (a.u.)')
158
+ plt.legend()
159
+ plt.savefig('figure1.pdf', dpi=300)
160
+ ```
161
+
162
+ ## Documentation
163
+
164
+ - **[FULL_DOCUMENTATION.md](FULL_DOCUMENTATION.md)** - Complete API reference and detailed guide
165
+ - **[examples/](examples/)** - Working examples (demo.py, showcase.py, simple_example.py)
166
+ - 12 test PDFs demonstrating all features
167
+
168
+ ## Quick Reference
169
+
170
+ | Feature | Command |
171
+ |---------|---------|
172
+ | Progressive width | `vary_linewidth=True` |
173
+ | Outline | `outline=True` |
174
+ | Centerline | `centerline=True` |
175
+ | Nature style | `apply_style_preset('nature')` |
176
+ | Color cycling | `color_idx=i` |
177
+ | Axis setup | `setup_axis(xlabel=..., ylabel=...)` |
178
+
179
+ ## Feature Comparison
180
+
181
+ | Feature | matplotlib | pltx |
182
+ |---------|-----------|------|
183
+ | Colorblind accessible | Manual | `vary_linewidth=True` |
184
+ | Line visibility | Complex code | `outline=True` |
185
+ | Journal styles | Research guidelines | One function call |
186
+ | Color palettes | Manual setup | Automatic |
187
+
188
+ ## Progressive Width Factors
189
+
190
+ | Factor | Increase | Best For |
191
+ |--------|----------|----------|
192
+ | 1.2 | 20% | 8-10 lines |
193
+ | 1.3 | 30% | 4-6 lines (DEFAULT) |
194
+ | 1.5 | 50% | 2-4 lines |
195
+
196
+ ## Style Presets
197
+
198
+ | Preset | Fonts | Figure Size | Use Case |
199
+ |--------|-------|-------------|----------|
200
+ | nature | 7-9pt | 3.5"x2.6" | Nature journal |
201
+ | presentation | 16-18pt | 10"x6" | Slides |
202
+ | poster | 24-28pt | 12"x8" | Posters |
203
+ | default | 12-13pt | 6"x4" | General |
204
+
205
+ ## Dependencies
206
+
207
+ **Required:**
208
+ - matplotlib >= 3.5.0
209
+ - numpy >= 1.20.0
210
+
211
+ **Optional:**
212
+ - seaborn >= 0.11.0 (for extended palettes; falls back to matplotlib colormaps)
213
+
214
+ ## Why pltx?
215
+
216
+ - **Accessible** - Works for colorblind viewers (~8% of males)
217
+ - **Publication-Ready** - Journal-specific presets
218
+ - **Easy to Use** - Drop-in replacement for matplotlib
219
+ - **Flexible** - Works with all plot types
220
+ - **Well-Documented** - Comprehensive guides and examples
221
+
222
+ ## Quick Tips
223
+
224
+ 1. **Always use** `vary_linewidth=True` for multi-line plots
225
+ 2. **Choose factor** based on number of lines (1.2 for many, 1.5 for few)
226
+ 3. **Test in grayscale** to verify accessibility
227
+ 4. **Use presets** to match your target medium
228
+ 5. **Combine features** for maximum effect
229
+
230
+ ## Testing
231
+
232
+ The package includes a comprehensive test suite using `pytest`.
233
+
234
+ ```bash
235
+ # Install test dependencies
236
+ pip install pytest
237
+
238
+ # Run all tests
239
+ pytest tests
240
+ ```
241
+
242
+ The test suite covers color palette logic, style initialization, enhanced plotting functions, and style context management.
243
+
244
+
245
+ ---
246
+
247
+ **Version:** 0.1.0
248
+ **Python:** 3.10+
249
+ **Created:** 2026-01-09
250
+ **Author:** Igor Sokolov
251
+
252
+ For complete documentation, see [FULL_DOCUMENTATION.md](FULL_DOCUMENTATION.md)