plotext-plus 1.0.9__tar.gz → 1.0.10__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.
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/PKG-INFO +7 -2
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/README.md +4 -0
- plotext_plus-1.0.10/docs/build.md +160 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/notes.md +2 -2
- plotext_plus-1.0.10/examples/advanced_features.py +175 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/examples/basic_plots.py +59 -45
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/examples/chart_classes_demo.py +115 -94
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/examples/interactive_demo.py +462 -329
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/examples/theme_showcase_demo.py +152 -106
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/pyproject.toml +13 -2
- plotext_plus-1.0.10/src/plotext_plus/__init__.py +36 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/src/plotext_plus/__main__.py +1 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/src/plotext_plus/_api.py +632 -371
- plotext_plus-1.0.10/src/plotext_plus/_build.py +886 -0
- plotext_plus-1.0.10/src/plotext_plus/_core.py +1047 -0
- plotext_plus-1.0.10/src/plotext_plus/_date.py +78 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/src/plotext_plus/_default.py +35 -28
- plotext_plus-1.0.10/src/plotext_plus/_dict.py +914 -0
- plotext_plus-1.0.10/src/plotext_plus/_doc.py +1278 -0
- plotext_plus-1.0.10/src/plotext_plus/_doc_utils.py +325 -0
- plotext_plus-1.0.10/src/plotext_plus/_figure.py +1483 -0
- plotext_plus-1.0.10/src/plotext_plus/_global.py +468 -0
- plotext_plus-1.0.10/src/plotext_plus/_matrix.py +325 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/src/plotext_plus/_monitor.py +1036 -489
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/src/plotext_plus/_output.py +29 -23
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/src/plotext_plus/_shtab.py +2 -0
- plotext_plus-1.0.10/src/plotext_plus/_themes.py +460 -0
- plotext_plus-1.0.10/src/plotext_plus/_utility.py +1121 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/src/plotext_plus/api.py +418 -332
- plotext_plus-1.0.10/src/plotext_plus/charts.py +65 -0
- plotext_plus-1.0.10/src/plotext_plus/core.py +974 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/src/plotext_plus/mcp_cli.py +15 -13
- plotext_plus-1.0.10/src/plotext_plus/mcp_server.py +1487 -0
- plotext_plus-1.0.10/src/plotext_plus/plotext_cli.py +521 -0
- plotext_plus-1.0.10/src/plotext_plus/plotting.py +108 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/src/plotext_plus/themes.py +10 -13
- plotext_plus-1.0.10/src/plotext_plus/utilities.py +52 -0
- plotext_plus-1.0.10/src/plotext_plus/utils.py +470 -0
- plotext_plus-1.0.10/tests/__init__.py +1 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_aspect_ratio.py +16 -13
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_chart_classes.py +108 -63
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_doughnut_simple.py +80 -53
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_final_pie.py +25 -18
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_image_video.py +50 -42
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_integration.py +21 -16
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_legend_colors.py +19 -16
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_new_api.py +82 -64
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_pie_chart.py +11 -8
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_pie_fill.py +20 -17
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_pie_gaps.py +25 -20
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/tests/test_pie_slices.py +17 -9
- plotext_plus-1.0.9/examples/advanced_features.py +0 -153
- plotext_plus-1.0.9/src/plotext_plus/__init__.py +0 -31
- plotext_plus-1.0.9/src/plotext_plus/_build.py +0 -270
- plotext_plus-1.0.9/src/plotext_plus/_core.py +0 -602
- plotext_plus-1.0.9/src/plotext_plus/_date.py +0 -60
- plotext_plus-1.0.9/src/plotext_plus/_dict.py +0 -210
- plotext_plus-1.0.9/src/plotext_plus/_doc.py +0 -707
- plotext_plus-1.0.9/src/plotext_plus/_doc_utils.py +0 -291
- plotext_plus-1.0.9/src/plotext_plus/_figure.py +0 -491
- plotext_plus-1.0.9/src/plotext_plus/_global.py +0 -370
- plotext_plus-1.0.9/src/plotext_plus/_matrix.py +0 -171
- plotext_plus-1.0.9/src/plotext_plus/_themes.py +0 -344
- plotext_plus-1.0.9/src/plotext_plus/_utility.py +0 -853
- plotext_plus-1.0.9/src/plotext_plus/charts.py +0 -42
- plotext_plus-1.0.9/src/plotext_plus/core.py +0 -581
- plotext_plus-1.0.9/src/plotext_plus/mcp_server.py +0 -1006
- plotext_plus-1.0.9/src/plotext_plus/plotext_cli.py +0 -382
- plotext_plus-1.0.9/src/plotext_plus/plotting.py +0 -92
- plotext_plus-1.0.9/src/plotext_plus/utilities.py +0 -52
- plotext_plus-1.0.9/src/plotext_plus/utils.py +0 -370
- plotext_plus-1.0.9/tests/__init__.py +0 -1
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/.gitignore +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/LICENSE +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/api.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/aspect.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/bar.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/basic.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/chart_classes.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/datetime.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/decorator.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/environments.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/image.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/mcp-server.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/settings.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/special.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/subplots.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/themes.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/utilities.md +0 -0
- {plotext_plus-1.0.9 → plotext_plus-1.0.10}/docs/video.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotext_plus
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.10
|
|
4
4
|
Summary: Modern terminal plotting library with enhanced visual features, themes, and AI integration
|
|
5
5
|
Project-URL: Homepage, https://github.com/ccmitchellusa/plotext_plus
|
|
6
6
|
Project-URL: Repository, https://github.com/ccmitchellusa/plotext_plus.git
|
|
@@ -23,6 +23,7 @@ Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
|
23
23
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
24
|
Classifier: Topic :: Terminals
|
|
25
25
|
Requires-Python: >=3.11
|
|
26
|
+
Requires-Dist: chuk-mcp-server>=0.3.5
|
|
26
27
|
Requires-Dist: chuk-term>=0.1.0
|
|
27
28
|
Requires-Dist: shtab>=1.7.2
|
|
28
29
|
Provides-Extra: completion
|
|
@@ -30,7 +31,7 @@ Requires-Dist: shtab; extra == 'completion'
|
|
|
30
31
|
Provides-Extra: image
|
|
31
32
|
Requires-Dist: pillow>=8.4; extra == 'image'
|
|
32
33
|
Provides-Extra: mcp
|
|
33
|
-
Requires-Dist: chuk-mcp-server>=0.
|
|
34
|
+
Requires-Dist: chuk-mcp-server>=0.3.5; extra == 'mcp'
|
|
34
35
|
Provides-Extra: video
|
|
35
36
|
Requires-Dist: ffpyplayer>=4.3.5; extra == 'video'
|
|
36
37
|
Requires-Dist: opencv-python>=4.5.5; extra == 'video'
|
|
@@ -301,3 +302,7 @@ plt.theme('professional')
|
|
|
301
302
|
plt.plot([1,2,3], [1,4,2])
|
|
302
303
|
plt.show()
|
|
303
304
|
```
|
|
305
|
+
|
|
306
|
+
## 🛠️ Development & Build System
|
|
307
|
+
|
|
308
|
+
Plotext+ includes a comprehensive build system with modern tooling. See **[Build Documentation](docs/build.md)** for complete setup, testing, publishing, and deployment instructions.
|
|
@@ -260,3 +260,7 @@ plt.theme('professional')
|
|
|
260
260
|
plt.plot([1,2,3], [1,4,2])
|
|
261
261
|
plt.show()
|
|
262
262
|
```
|
|
263
|
+
|
|
264
|
+
## 🛠️ Development & Build System
|
|
265
|
+
|
|
266
|
+
Plotext+ includes a comprehensive build system with modern tooling. See **[Build Documentation](docs/build.md)** for complete setup, testing, publishing, and deployment instructions.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# 🛠️ Development & Build System
|
|
2
|
+
|
|
3
|
+
Plotext+ includes a comprehensive build system with modern tooling for development, testing, and deployment.
|
|
4
|
+
|
|
5
|
+
## Quick Development Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Clone and setup
|
|
9
|
+
git clone https://github.com/ccmitchellusa/plotext_plus.git
|
|
10
|
+
cd plotext_plus
|
|
11
|
+
|
|
12
|
+
# Development environment setup
|
|
13
|
+
make dev # Install all dependencies + format + test
|
|
14
|
+
make setup # Alternative: setup development environment
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Build Commands
|
|
18
|
+
|
|
19
|
+
### **🌱 Environment & Installation**
|
|
20
|
+
```bash
|
|
21
|
+
make install # Install basic dependencies
|
|
22
|
+
make install-dev # Install with development tools
|
|
23
|
+
make install-mcp # Install with MCP server support
|
|
24
|
+
make install-all # Install with all optional dependencies
|
|
25
|
+
make update # Update all dependencies
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### **🧪 Testing & Quality**
|
|
29
|
+
```bash
|
|
30
|
+
make test # Run tests with coverage
|
|
31
|
+
make test-fast # Run tests without coverage
|
|
32
|
+
make test-mcp # Test MCP server functionality
|
|
33
|
+
make coverage # Generate coverage reports
|
|
34
|
+
|
|
35
|
+
# Code quality
|
|
36
|
+
make lint # Run full linting suite (ruff + black + isort + mypy)
|
|
37
|
+
make lint-check # Check linting without fixing
|
|
38
|
+
make format # Format code (black + isort)
|
|
39
|
+
make ruff # Ruff linting and formatting
|
|
40
|
+
make black # Black code formatting
|
|
41
|
+
make isort # Import sorting
|
|
42
|
+
make mypy # Type checking
|
|
43
|
+
make bandit # Security analysis
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### **📦 Building & Publishing**
|
|
47
|
+
```bash
|
|
48
|
+
make build # Build Python package
|
|
49
|
+
make publish # Build and publish to PyPI (with twine)
|
|
50
|
+
make publish-test # Publish to TestPyPI
|
|
51
|
+
make clean # Clean build artifacts
|
|
52
|
+
|
|
53
|
+
# Version management
|
|
54
|
+
make bump-patch # Bump patch version (1.0.0 → 1.0.1)
|
|
55
|
+
make bump-minor # Bump minor version (1.0.0 → 1.1.0)
|
|
56
|
+
make bump-major # Bump major version (1.0.0 → 2.0.0)
|
|
57
|
+
|
|
58
|
+
# Combined release workflow
|
|
59
|
+
make release-patch # Bump patch + publish
|
|
60
|
+
make release-minor # Bump minor + publish
|
|
61
|
+
make release-major # Bump major + publish
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### **🐋 Container Operations**
|
|
65
|
+
```bash
|
|
66
|
+
# Docker
|
|
67
|
+
make docker-build # Build Docker image
|
|
68
|
+
make docker-up # Start with Docker Compose
|
|
69
|
+
make docker-down # Stop Docker Compose
|
|
70
|
+
make docker-logs # View container logs
|
|
71
|
+
make docker-clean # Clean containers and images
|
|
72
|
+
|
|
73
|
+
# Podman
|
|
74
|
+
make podman-build # Build with Podman
|
|
75
|
+
make podman-run-mcp # Run MCP server container
|
|
76
|
+
make podman-test # Test container health
|
|
77
|
+
make podman-logs # Follow container logs
|
|
78
|
+
make podman-stats # Show resource usage
|
|
79
|
+
make podman-shell # Interactive shell access
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### **☁️ Cloud Deployment**
|
|
83
|
+
```bash
|
|
84
|
+
# IBM Cloud Code Engine
|
|
85
|
+
make ce-push-image # Push to IBM Container Registry
|
|
86
|
+
make ce-deploy # Deploy to Code Engine
|
|
87
|
+
make ce-update # Update existing deployment
|
|
88
|
+
make ce-status # Check deployment status
|
|
89
|
+
make ce-logs # View application logs
|
|
90
|
+
make ce-full-deploy # Complete deployment workflow
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### **🎯 Quick Workflows**
|
|
94
|
+
```bash
|
|
95
|
+
make dev # Development setup (install-all + format + test-fast)
|
|
96
|
+
make check # Quick validation (lint-check + test-fast)
|
|
97
|
+
make all # Full pipeline (format + lint + test + build)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### **▶️ Running & Demo**
|
|
101
|
+
```bash
|
|
102
|
+
make run-mcp # Start MCP server
|
|
103
|
+
make run-demos # Run interactive examples
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### **🔧 Utilities**
|
|
107
|
+
```bash
|
|
108
|
+
make version # Show version information
|
|
109
|
+
make info # Show project information
|
|
110
|
+
make deps # Show dependency tree
|
|
111
|
+
make help # Show all available targets
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Project Structure
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
plotext_plus/
|
|
118
|
+
├── src/plotext_plus/ # 🎯 Main source code
|
|
119
|
+
│ ├── plotting.py # Core plotting functions
|
|
120
|
+
│ ├── charts.py # Chart classes
|
|
121
|
+
│ ├── themes.py # Theme system
|
|
122
|
+
│ ├── utilities.py # Helper functions
|
|
123
|
+
│ ├── mcp_server.py # MCP server (optional)
|
|
124
|
+
│ └── _*.py # 🔒 Private modules
|
|
125
|
+
├── examples/ # Interactive demos
|
|
126
|
+
├── tests/ # Test suites
|
|
127
|
+
├── docs/ # Documentation
|
|
128
|
+
├── .github/workflows/ # CI/CD automation
|
|
129
|
+
├── docker/ # Container files
|
|
130
|
+
└── Makefile # Build system
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Development Workflow
|
|
134
|
+
|
|
135
|
+
1. **Setup**: `make dev`
|
|
136
|
+
2. **Code**: Write your changes
|
|
137
|
+
3. **Quality**: `make check` (lint + test)
|
|
138
|
+
4. **Comprehensive**: `make all` (full pipeline)
|
|
139
|
+
5. **Deploy**: `make release-patch` (version + publish)
|
|
140
|
+
|
|
141
|
+
## CI/CD Integration
|
|
142
|
+
|
|
143
|
+
The project includes comprehensive GitHub Actions workflows:
|
|
144
|
+
|
|
145
|
+
- **🔄 CI**: Automated testing, linting, security scanning
|
|
146
|
+
- **🚀 Release**: Automated publishing to PyPI + container registry
|
|
147
|
+
- **🔒 Security**: Daily security scans, dependency updates
|
|
148
|
+
- **📦 Dependencies**: Weekly automated dependency updates
|
|
149
|
+
|
|
150
|
+
All workflows use modern tooling (uv, ruff, mypy, pytest) for fast, reliable builds.
|
|
151
|
+
|
|
152
|
+
## Quality Standards
|
|
153
|
+
|
|
154
|
+
- **Code Quality**: Ruff + Black + isort for consistent formatting
|
|
155
|
+
- **Type Safety**: MyPy for static type checking
|
|
156
|
+
- **Security**: Bandit for security analysis
|
|
157
|
+
- **Testing**: Pytest with coverage reporting
|
|
158
|
+
- **Documentation**: Comprehensive docs with examples
|
|
159
|
+
|
|
160
|
+
Use `make help` to see all available commands with descriptions.
|
|
@@ -98,7 +98,7 @@ plt.test() # Downloads and displays a test image, then removes it
|
|
|
98
98
|
- add heatmap plot, as requested in issue [Issue 143](https://github.com/ccmitchellusa/plotext_plus/issues/143)
|
|
99
99
|
- add OHLC date time plot, as requested in issue [Issue 149](https://github.com/ccmitchellusa/plotext_plus/issues/149)
|
|
100
100
|
- add network graphs, as requested in issue [Issue 160](https://github.com/ccmitchellusa/plotext_plus/issues/160)
|
|
101
|
-
- integrate `colorize()` in `text()` and `indicator()` or or any string `label` parameter, as requested in issue [Issue 144](https://github.com/ccmitchellusa/plotext_plus/issues/144); possible idea: `colorize()` to output a `
|
|
101
|
+
- integrate `colorize()` in `text()` and `indicator()` or or any string `label` parameter, as requested in issue [Issue 144](https://github.com/ccmitchellusa/plotext_plus/issues/144); possible idea: `colorize()` to output a `MatrixClass()` object
|
|
102
102
|
- allow simple bar plots in matrix of subplots, as requested in issue [Issue 171](https://github.com/ccmitchellusa/plotext_plus/issues/171); this could be possibly extended to allow images also, rendered with fast parameter set to `True`
|
|
103
103
|
- allow user to decide plot legend position and frame
|
|
104
104
|
- allow clickable plots, as requested in issue [Issue 175](https://github.com/ccmitchellusa/plotext_plus/issues/175); this sounds hard!
|
|
@@ -125,7 +125,7 @@ plt.test() # Downloads and displays a test image, then removes it
|
|
|
125
125
|
- add matrix plot side bar, to connect intensity level with actual matrix value
|
|
126
126
|
- high resolution markers available on Windows and other rarer terminals (under request and not sure how)
|
|
127
127
|
- add method to optionally set the sizes of a matrix of subplots giving priority to the subplots closer to bottom right edge, instead of upper left ones (as by default)
|
|
128
|
-
- convert the class `
|
|
128
|
+
- convert the class `MatrixClass()`, the engine running the plots, in C++ and connect it to the Python code (not sure how and would appreciate some help on this)
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
### Internal Conventions
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Advanced Plotext features demonstration.
|
|
4
|
+
Shows banner customization, themes, and complex visualizations.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
|
|
11
|
+
|
|
12
|
+
import math
|
|
13
|
+
import random
|
|
14
|
+
|
|
15
|
+
import plotext_plus as plt
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def custom_banner_example():
|
|
19
|
+
"""Demonstrate custom banner titles and styling"""
|
|
20
|
+
plt.log_info("🎨 Demonstrating custom banners...")
|
|
21
|
+
|
|
22
|
+
x = list(range(25))
|
|
23
|
+
y = [10 + 5 * math.sin(i / 3) + random.randint(-2, 2) for i in x]
|
|
24
|
+
|
|
25
|
+
# Custom themed banner
|
|
26
|
+
(
|
|
27
|
+
plt.Chart(use_banners=True, banner_title="🌊 Signal Processing")
|
|
28
|
+
.line(x, y, color="cyan", label="Noisy Signal")
|
|
29
|
+
.title("Real-time Data Analysis")
|
|
30
|
+
.xlabel("Time Samples")
|
|
31
|
+
.ylabel("Amplitude")
|
|
32
|
+
.show()
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def scientific_visualization():
|
|
37
|
+
"""Scientific data visualization example"""
|
|
38
|
+
plt.log_info("🔬 Creating scientific visualization...")
|
|
39
|
+
|
|
40
|
+
# Generate experimental data
|
|
41
|
+
temperature = list(range(20, 101, 5))
|
|
42
|
+
pressure = [t * 0.8 + random.randint(-5, 5) for t in temperature]
|
|
43
|
+
theoretical = [t * 0.75 for t in temperature]
|
|
44
|
+
|
|
45
|
+
chart = (
|
|
46
|
+
plt.Chart(use_banners=True, banner_title="🧪 Laboratory Results")
|
|
47
|
+
.scatter(temperature, pressure, color="red", label="Experimental")
|
|
48
|
+
.line(temperature, theoretical, color="blue", label="Theoretical")
|
|
49
|
+
.title("Temperature vs Pressure Analysis")
|
|
50
|
+
.xlabel("Temperature (°C)")
|
|
51
|
+
.ylabel("Pressure (kPa)")
|
|
52
|
+
.show()
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def business_dashboard():
|
|
57
|
+
"""Business dashboard example"""
|
|
58
|
+
plt.log_info("📊 Creating business dashboard...")
|
|
59
|
+
|
|
60
|
+
# Revenue data
|
|
61
|
+
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
|
|
62
|
+
revenue = [120, 135, 158, 142, 167, 181]
|
|
63
|
+
target = [150] * len(months)
|
|
64
|
+
|
|
65
|
+
chart = (
|
|
66
|
+
plt.Chart(use_banners=True, banner_title="💼 Revenue Dashboard")
|
|
67
|
+
.bar(months, revenue, color="green")
|
|
68
|
+
.line(list(range(len(months))), target, color="red", label="Target")
|
|
69
|
+
.title("Monthly Revenue Performance")
|
|
70
|
+
.show()
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def mathematical_functions():
|
|
75
|
+
"""Mathematical function plotting"""
|
|
76
|
+
plt.log_info("📐 Plotting mathematical functions...")
|
|
77
|
+
|
|
78
|
+
x = [i / 10 for i in range(-50, 51)]
|
|
79
|
+
sin_values = [math.sin(val) for val in x]
|
|
80
|
+
cos_values = [math.cos(val) for val in x]
|
|
81
|
+
|
|
82
|
+
chart = (
|
|
83
|
+
plt.Chart(use_banners=True, banner_title="📈 Mathematical Functions")
|
|
84
|
+
.line(x, sin_values, color="blue", label="sin(x)")
|
|
85
|
+
.line(x, cos_values, color="red", label="cos(x)")
|
|
86
|
+
.title("Trigonometric Functions")
|
|
87
|
+
.xlabel("x")
|
|
88
|
+
.ylabel("f(x)")
|
|
89
|
+
.show()
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def performance_comparison():
|
|
94
|
+
"""Performance comparison chart"""
|
|
95
|
+
plt.log_info("⚡ Creating performance comparison...")
|
|
96
|
+
|
|
97
|
+
algorithms = ["Algorithm A", "Algorithm B", "Algorithm C", "Algorithm D"]
|
|
98
|
+
execution_times = [2.3, 1.8, 3.1, 1.2]
|
|
99
|
+
memory_usage = [45, 32, 67, 28]
|
|
100
|
+
|
|
101
|
+
# Time comparison
|
|
102
|
+
plt.quick_bar(
|
|
103
|
+
algorithms,
|
|
104
|
+
execution_times,
|
|
105
|
+
title="Execution Time Comparison",
|
|
106
|
+
use_banners=True,
|
|
107
|
+
banner_title="⏱️ Performance Metrics",
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
print("\n" + "-" * 40 + "\n")
|
|
111
|
+
|
|
112
|
+
# Memory comparison
|
|
113
|
+
plt.quick_bar(
|
|
114
|
+
algorithms,
|
|
115
|
+
memory_usage,
|
|
116
|
+
title="Memory Usage Comparison",
|
|
117
|
+
use_banners=True,
|
|
118
|
+
banner_title="💾 Memory Analysis",
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def output_features_demo():
|
|
123
|
+
"""Demonstrate chuk-term output features"""
|
|
124
|
+
plt.log_info("🎯 Demonstrating output features...")
|
|
125
|
+
|
|
126
|
+
# Various output levels
|
|
127
|
+
plt.log_info("📋 Processing data...")
|
|
128
|
+
plt.log_success("✅ Data loaded successfully")
|
|
129
|
+
plt.log_warning("⚠️ Using default parameters")
|
|
130
|
+
plt.log_error("❌ Minor calculation error detected")
|
|
131
|
+
|
|
132
|
+
# Simple visualization with context
|
|
133
|
+
x = list(range(8))
|
|
134
|
+
y = [i**1.5 for i in x]
|
|
135
|
+
|
|
136
|
+
plt.log_info("📊 Generating final visualization...")
|
|
137
|
+
|
|
138
|
+
chart = (
|
|
139
|
+
plt.Chart(use_banners=True, banner_title="🎯 Final Results")
|
|
140
|
+
.scatter(x, y, color="purple", label="Growth Curve")
|
|
141
|
+
.title("Project Completion Analysis")
|
|
142
|
+
.xlabel("Weeks")
|
|
143
|
+
.ylabel("Progress")
|
|
144
|
+
.show()
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
plt.log_success("🎉 Analysis complete!")
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def main():
|
|
151
|
+
"""Run all advanced examples"""
|
|
152
|
+
plt.log_success("🌟 Starting Advanced Plotext Features Demo")
|
|
153
|
+
|
|
154
|
+
custom_banner_example()
|
|
155
|
+
print("\n" + "=" * 60 + "\n")
|
|
156
|
+
|
|
157
|
+
scientific_visualization()
|
|
158
|
+
print("\n" + "=" * 60 + "\n")
|
|
159
|
+
|
|
160
|
+
business_dashboard()
|
|
161
|
+
print("\n" + "=" * 60 + "\n")
|
|
162
|
+
|
|
163
|
+
mathematical_functions()
|
|
164
|
+
print("\n" + "=" * 60 + "\n")
|
|
165
|
+
|
|
166
|
+
performance_comparison()
|
|
167
|
+
print("\n" + "=" * 60 + "\n")
|
|
168
|
+
|
|
169
|
+
output_features_demo()
|
|
170
|
+
|
|
171
|
+
plt.log_success("✨ All advanced examples completed!")
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
if __name__ == "__main__":
|
|
175
|
+
main()
|
|
@@ -4,113 +4,127 @@ Basic plotting examples using the new Plotext API with chuk-term integration.
|
|
|
4
4
|
Demonstrates simple scatter plots, line plots, and bar charts.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
import sys
|
|
8
7
|
import os
|
|
9
|
-
sys
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
|
|
10
11
|
|
|
11
12
|
import plotext_plus as plt
|
|
12
13
|
|
|
14
|
+
|
|
13
15
|
def basic_scatter_example():
|
|
14
16
|
"""Simple scatter plot example"""
|
|
15
17
|
plt.log_info("Creating basic scatter plot...")
|
|
16
|
-
|
|
18
|
+
|
|
17
19
|
# Sample data
|
|
18
20
|
x = list(range(10))
|
|
19
21
|
y = [i**2 for i in x]
|
|
20
|
-
|
|
22
|
+
|
|
21
23
|
# Traditional API
|
|
22
|
-
plt.scatter(x, y, color=
|
|
24
|
+
plt.scatter(x, y, color="blue")
|
|
23
25
|
plt.title("Basic Scatter Plot - Traditional API")
|
|
24
26
|
plt.xlabel("X Values")
|
|
25
27
|
plt.ylabel("Y Values")
|
|
26
28
|
plt.show()
|
|
27
29
|
|
|
30
|
+
|
|
28
31
|
def enhanced_scatter_example():
|
|
29
32
|
"""Enhanced scatter plot with banner mode"""
|
|
30
33
|
plt.log_info("Creating enhanced scatter plot with banners...")
|
|
31
|
-
|
|
34
|
+
|
|
32
35
|
# Sample data
|
|
33
36
|
x = list(range(15))
|
|
34
|
-
y = [i*1.5 + (i%3)*2 for i in x]
|
|
35
|
-
|
|
37
|
+
y = [i * 1.5 + (i % 3) * 2 for i in x]
|
|
38
|
+
|
|
36
39
|
# New object-oriented API with banner
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
(
|
|
41
|
+
plt.Chart(use_banners=True, banner_title="📊 Enhanced Visualization")
|
|
42
|
+
.scatter(x, y, color="red", label="Data Points")
|
|
43
|
+
.title("Enhanced Scatter Plot")
|
|
44
|
+
.xlabel("Time Steps")
|
|
45
|
+
.ylabel("Measurements")
|
|
46
|
+
.show()
|
|
47
|
+
)
|
|
48
|
+
|
|
43
49
|
|
|
44
50
|
def line_plot_example():
|
|
45
51
|
"""Simple line plot example"""
|
|
46
52
|
plt.log_info("Creating line plot...")
|
|
47
|
-
|
|
53
|
+
|
|
48
54
|
# Sample data
|
|
49
55
|
x = list(range(20))
|
|
50
|
-
y = [i + (i%5)*1.5 for i in x]
|
|
51
|
-
|
|
56
|
+
y = [i + (i % 5) * 1.5 for i in x]
|
|
57
|
+
|
|
52
58
|
# Quick function API
|
|
53
59
|
plt.quick_line(
|
|
54
|
-
x,
|
|
60
|
+
x,
|
|
61
|
+
y,
|
|
55
62
|
title="Quick Line Plot",
|
|
56
63
|
xlabel="Time",
|
|
57
64
|
ylabel="Value",
|
|
58
65
|
use_banners=True,
|
|
59
|
-
banner_title="📈 Trend Analysis"
|
|
66
|
+
banner_title="📈 Trend Analysis",
|
|
60
67
|
)
|
|
61
68
|
|
|
69
|
+
|
|
62
70
|
def bar_chart_example():
|
|
63
71
|
"""Simple bar chart example"""
|
|
64
72
|
plt.log_info("Creating bar chart...")
|
|
65
|
-
|
|
73
|
+
|
|
66
74
|
# Sample data
|
|
67
|
-
categories = [
|
|
75
|
+
categories = ["A", "B", "C", "D", "E"]
|
|
68
76
|
values = [23, 17, 35, 29, 12]
|
|
69
|
-
|
|
77
|
+
|
|
70
78
|
# Quick bar chart
|
|
71
79
|
plt.quick_bar(
|
|
72
|
-
categories,
|
|
80
|
+
categories,
|
|
81
|
+
values,
|
|
73
82
|
title="Sample Bar Chart",
|
|
74
83
|
use_banners=True,
|
|
75
|
-
banner_title="📊 Category Analysis"
|
|
84
|
+
banner_title="📊 Category Analysis",
|
|
76
85
|
)
|
|
77
86
|
|
|
87
|
+
|
|
78
88
|
def multiple_series_example():
|
|
79
89
|
"""Multiple data series on one chart"""
|
|
80
90
|
plt.log_info("Creating multi-series plot...")
|
|
81
|
-
|
|
91
|
+
|
|
82
92
|
x = list(range(12))
|
|
83
|
-
y1 = [i*2 for i in x]
|
|
93
|
+
y1 = [i * 2 for i in x]
|
|
84
94
|
y2 = [i**1.5 for i in x]
|
|
85
|
-
|
|
95
|
+
|
|
86
96
|
# Object-oriented API with multiple series
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
(
|
|
98
|
+
plt.Chart(use_banners=True, banner_title="📈 Comparison Chart")
|
|
99
|
+
.line(x, y1, color="blue", label="Linear")
|
|
100
|
+
.scatter(x, y2, color="red", label="Power")
|
|
101
|
+
.title("Multiple Data Series")
|
|
102
|
+
.xlabel("X Axis")
|
|
103
|
+
.ylabel("Y Axis")
|
|
104
|
+
.show()
|
|
105
|
+
)
|
|
106
|
+
|
|
94
107
|
|
|
95
108
|
def main():
|
|
96
109
|
"""Run all basic examples"""
|
|
97
110
|
plt.log_success("🚀 Starting Basic Plotext Examples")
|
|
98
|
-
|
|
111
|
+
|
|
99
112
|
basic_scatter_example()
|
|
100
|
-
print("\n" + "="*50 + "\n")
|
|
101
|
-
|
|
113
|
+
print("\n" + "=" * 50 + "\n")
|
|
114
|
+
|
|
102
115
|
enhanced_scatter_example()
|
|
103
|
-
print("\n" + "="*50 + "\n")
|
|
104
|
-
|
|
116
|
+
print("\n" + "=" * 50 + "\n")
|
|
117
|
+
|
|
105
118
|
line_plot_example()
|
|
106
|
-
print("\n" + "="*50 + "\n")
|
|
107
|
-
|
|
119
|
+
print("\n" + "=" * 50 + "\n")
|
|
120
|
+
|
|
108
121
|
bar_chart_example()
|
|
109
|
-
print("\n" + "="*50 + "\n")
|
|
110
|
-
|
|
122
|
+
print("\n" + "=" * 50 + "\n")
|
|
123
|
+
|
|
111
124
|
multiple_series_example()
|
|
112
|
-
|
|
125
|
+
|
|
113
126
|
plt.log_success("✅ All basic examples completed!")
|
|
114
127
|
|
|
128
|
+
|
|
115
129
|
if __name__ == "__main__":
|
|
116
|
-
main()
|
|
130
|
+
main()
|