lightenplot
Dramatically Simplify Data Visualization in Python
Lightenplot is a Python library that reduces complex visualization code into single-line commands, while maintaining the power and flexibility of matplotlib and seaborn.
Table of Contents
- Features
- Installation
- Quick Start
- Examples
- Plot Composition
- Themes
- Exporting Plots
- Architecture Overview
- API Reference
- Testing
- Documentation
- Contributing
- RichieClan Team
- License
- Contact
Features
- One-Line Plotting: Create beautiful visualizations with single commands
- Method Chaining: Fluent API for intuitive plot customization
- Built-in Themes: Multiple professional themes (default, dark, minimal, colorful)
- Comprehensive Plot Types: Scatter, line, bar, histogram, box, heatmap
- Smart Composition: Easily combine multiple plots
- Easy Export: Save in multiple formats (PNG, PDF, SVG)
- Full OOP Design: Encapsulation, inheritance, polymorphism
Installation
pip install lightenplot
From Source
git clone https://github.com/khassndrajayme/lightenplot.git
cd lightenplot
pip install -r requirement.txt
pip install -e .
Quick Start
Traditional Way (10+ lines)
import matplotlib.pyplot as plt
import pandas as pd
data = pd.DataFrame({'x': [1, 2, 3, 4], 'y': [2, 4, 6, 8]})
fig, ax = plt.subplots(figsize=(10, 6))
ax.scatter(data['x'], data['y'], alpha=0.6)
ax.set_xlabel('X Values')
ax.set_ylabel('Y Values')
ax.set_title('My Scatter Plot')
ax.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()
LightenPlot Way (1 line!)
import lightenplot as lp
import pandas as pd
data = pd.DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
lp.scatter(data, x='x', y='y').set_title('My Scatter Plot').show()
PyPI Package:
https://pypi.org/project/lightenplot/
Examples
Scatter Plot
import lightenplot as lp
import pandas as pd
data = pd.DataFrame({
'age': [25, 30, 35, 40, 45],
'salary': [50000, 60000, 75000, 80000, 95000]
})
lp.scatter(data, x='age', y='salary', color='steelblue') \
.set_title('Age vs Salary') \
.set_labels('Age (years)', 'Salary ($)') \
.apply_theme('minimal') \
.save('plot.png') \
.show()
Line Plot
lp.line(data, x='month', y='revenue', color='#FF6B6B', linewidth=2.5) \
.set_title('Monthly Revenue') \
.apply_theme('dark') \
.show()
Bar Plot
lp.bar(data, x='category', y='value', color='#4ECDC4') \
.set_title('Sales by Category') \
.show()
Histogram
import numpy as np
ages = np.random.normal(35, 10, 1000)
lp.histogram(ages, bins=30, color='skyblue') \
.set_title('Age Distribution') \
.show()
Box Plot
lp.boxplot(data, columns=['Group_A', 'Group_B', 'Group_C']) \
.set_title('Performance Comparison') \
.show()
Heatmap
correlation_matrix = data.corr()
lp.heatmap(correlation_matrix, cmap='coolwarm', annot=True) \
.set_title('Correlation Matrix') \
.show()
Plot Composition
# Create individual plots
plot1 = lp.scatter(data, x='x', y='y')
plot2 = lp.line(data, x='date', y='value')
plot3 = lp.bar(data, x='cat', y='count')
plot4 = lp.histogram(values, bins=20)
# Compose into 2x2 grid
composer = lp.compose(rows=2, cols=2)
composer.add_plot(plot1).add_plot(plot2).add_plot(plot3).add_plot(plot4)
composer.show()
Themes
Lightenplot includes 4 built-in themes:
default: Clean, professional lookdark: Dark mode with high contrastminimal: Minimalist design with no spinescolorful: Vibrant, eye-catching colors
# Apply theme
plot.apply_theme('dark')
# List available themes
print(lp.ThemeManager.list_themes())
Exporting Plots
# Single format
plot.save('output.png', dpi=300)
# Multiple formats
from lightenplot import PlotExporter
exporter = PlotExporter(plot.figure)
exporter.save_multiple('output', formats=['png', 'pdf', 'svg'])
Architecture
Lightenplot is built with solid OOP principles:
Core Classes
- BasePlot: Abstract base class for all plots
- ScatterPlot, LinePlot, BarPlot, etc.: Specific plot implementations
- PlotComposer: Compose multiple plots (composition pattern)
- ThemeManager: Manage and apply themes (singleton pattern)
- PlotExporter: Handle plot exports
OOP Features Demonstrated
- Encapsulation: Private attributes (
_data,_theme) - Inheritance: All plots inherit from
BasePlot - Polymorphism: Theme classes with common interface
- Composition:
PlotComposercontainsBasePlotinstances - Dunder Methods:
__repr__,__str__,__eq__,__lt__
API Reference
Quick Functions
| Function | Description |
|---|---|
scatter() |
Create scatter plot |
line() |
Create line plot |
bar() |
Create bar plot |
histogram() |
Create histogram |
boxplot() |
Create box plot |
heatmap() |
Create heatmap |
compose() |
Create plot composer |
Common Methods
| Method | Description |
|---|---|
.set_title(title) |
Set plot title |
.set_labels(x, y) |
Set axis labels |
.apply_theme(name) |
Apply theme |
.save(filename) |
Save plot |
.show() |
Display plot |
Testing
Run unit tests:
# Simple run
pytest tests/test_all.py
# Verbose (shows test names)
pytest tests/test_all.py -v
# Show print statements
pytest tests/test_all.py -v -s
# Stop on first failure
pytest tests/test_all.py -x
# Run specific test class
pytest tests/test_all.py::TestScatterPlot -v
# Run specific test method
pytest tests/test_all.py::TestScatterPlot::test_scatter_creation -v
# With coverage
pytest tests/test_all.py --cov=lightenplot --cov-report=term
# Run all tests in tests/ folder
pytest tests/
Or with unittest:
python -m unittest discover tests/
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
RichieClan Team
- Khassandra Louise C. Jayme - Lead Developer - GitHub
- Sheena Angela T. Janog - Developer - GitHub
- Xavier Neo Mahilum - Developer - GitHub
- Allen Floro Ventura - Developer - GitHub
- Genetyron Zamoranos - Developer - GitHub
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built on top of Matplotlib
- Inspired by Seaborn
- Thanks to our instructor for guidance and support
- Inspired by matplotlib, seaborn, and ggplot2
Contact
For questions or feedback, please open an issue on GitHub or contact us at khassandrajayme@gmail.com
Made with Love by RichieClan
Metadata
Release files for lightenplot 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lightenplot-0.5.0.tar.gz | 14.6 kB | Without provenance | Details for lightenplot-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lightenplot-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for lightenplot-0.5.0-py3-none-any.whl |
Total release size: 28.7 kB
Release files / lightenplot-0.5.0.tar.gz
| Download URL | lightenplot-0.5.0.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6f989ff79bfd317e8476f309db97258ae55d78d92a054aecd07c446f18d8a68
|
|
BLAKE2b-256 checksum How to use checksums |
f4555e6336674c8bba474d5c22b1af6456befece6267b86a031e2b57e247919e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.5
|
Release files / lightenplot-0.5.0-py3-none-any.whl
| Download URL | lightenplot-0.5.0-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eff1c70cb1397c94a48bcbfda0ea65338d9423d7c8d44e769e554ab291f26ebc
|
|
BLAKE2b-256 checksum How to use checksums |
b89ee7ba2026b2cfc73d98eba40fb360c7cbe3bab786866078dbdb39d906d250
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.5
|
Security for lightenplot 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.