Create beautiful plots in Wisent brand styling
Project description
Wisent Plots
Create beautiful, brand-styled plots with ease. This package provides ready-to-use chart types that follow Wisent's visual identity guidelines.
Features
- 5 Pre-configured Styles: Choose from 5 professionally designed styles
- Easy to Use: Simple API that works with familiar data structures
- Customizable: Override colors and settings as needed
- High Quality: Publication-ready output with customizable DPI
- Type Hints: Full type annotation support
Installation
pip install wisent-plots
For development:
git clone https://github.com/wisent/wisent-plots
cd wisent-plots
pip install -e ".[dev]"
Quick Start
from wisent_plots import AreaChart
# Create data
x = [1, 2, 3, 4, 5]
y = [2, 4, 3, 5, 4]
# Create chart with style 1 and edge enabled
chart = AreaChart(style=1, edge=True)
# Plot
fig, ax = chart.plot(
x=x,
y=y,
title="My Chart",
xlabel="Time",
ylabel="Value"
)
# Save or show
chart.save(fig, "my_chart.png")
# Or: plt.show()
Available Styles
The package includes 5 distinct styles, each with unique color palettes and typography:
- Corporate (style=1): Professional deep blue theme
- Minimal (style=2): Clean, understated design
- Bold (style=3): High-contrast, vibrant colors
- Academic (style=4): Classic, publication-ready style
- Modern (style=5): Contemporary gradient colors
Customizing Styles with Figma
To match your exact Figma design specifications:
- Open
wisent_plots/styles/style_config.py - Update the color values, fonts, and spacing for each style
- The comments marked with
# UPDATE with Figmashow where to add your brand colors
Example of what to update:
"colors": {
"primary": "#1E3A8A", # UPDATE: Replace with your primary brand color
"secondary": "#3B82F6", # UPDATE: Replace with your secondary color
# ... etc
},
"font": {
"family": "Arial", # UPDATE: Replace with your brand font
# ...
}
Usage Examples
Single Series Area Chart
import numpy as np
from wisent_plots import AreaChart
x = np.linspace(0, 10, 50)
y = np.sin(x) * 3 + 5
chart = AreaChart(style=1, edge=True)
fig, ax = chart.plot(
x=x,
y=y,
title="Sales Growth",
xlabel="Month",
ylabel="Revenue ($1000s)",
label="Q1 Sales"
)
chart.save(fig, "sales_chart.png", dpi=300)
Multiple Series
chart = AreaChart(style=2, edge=False)
y1 = np.sin(x) * 3 + 5
y2 = np.cos(x) * 2 + 5
y3 = np.sin(x * 0.5) * 2 + 3
fig, ax = chart.plot_multiple(
x=x,
y_series=[y1, y2, y3],
labels=["Product A", "Product B", "Product C"],
title="Product Comparison",
xlabel="Time (weeks)",
ylabel="Units Sold"
)
chart.save(fig, "comparison.png")
Custom Colors
chart = AreaChart(style=1, edge=True)
fig, ax = chart.plot(
x=x,
y=y,
title="Custom Colored Chart",
color="#FF6B6B", # Custom coral color
label="Custom Series"
)
Using with Existing Matplotlib Figures
import matplotlib.pyplot as plt
fig, axes = plt.subplots(2, 2, figsize=(12, 10))
chart1 = AreaChart(style=1)
chart1.plot(x, y1, title="Chart 1", fig=fig, ax=axes[0, 0])
chart2 = AreaChart(style=2)
chart2.plot(x, y2, title="Chart 2", fig=fig, ax=axes[0, 1])
plt.tight_layout()
plt.savefig("grid.png")
API Reference
AreaChart
Constructor Parameters:
style(int, default=1): Style number (1-5)edge(bool, default=False): Whether to draw edge around filled areafigsize(tuple, default=(10, 6)): Figure size as (width, height) in inchesdpi(int, default=100): Resolution in dots per inch
Methods:
plot(x, y, title=None, xlabel=None, ylabel=None, color=None, label=None, fig=None, ax=None)
Create a single-series area chart.
Parameters:
x: X-axis data (list or numpy array)y: Y-axis data (list or numpy array)title: Chart title (optional)xlabel: X-axis label (optional)ylabel: Y-axis label (optional)color: Custom color as hex string (optional)label: Legend label (optional)fig: Existing matplotlib Figure (optional)ax: Existing matplotlib Axes (optional)
Returns: (fig, ax) tuple
plot_multiple(x, y_series, labels=None, colors=None, title=None, xlabel=None, ylabel=None, fig=None, ax=None)
Create a multi-series area chart.
Parameters:
x: X-axis data (list or numpy array)y_series: List of Y-axis data arrayslabels: List of legend labels (optional)colors: List of colors for each series (optional)title: Chart title (optional)xlabel: X-axis label (optional)ylabel: Y-axis label (optional)fig: Existing matplotlib Figure (optional)ax: Existing matplotlib Axes (optional)
Returns: (fig, ax) tuple
save(fig, filename, dpi=None, transparent=False)
Save the figure to a file.
Parameters:
fig: Figure object to savefilename: Output filename with extension (e.g., 'chart.png')dpi: Resolution in dots per inch (optional, uses figure dpi if not specified)transparent: Whether to save with transparent background (default=False)
Development
Running Examples
cd examples
python quick_start.py
python area_chart_demo.py
Running Tests
pytest tests/
Code Formatting
black wisent_plots/
isort wisent_plots/
Building and Publishing
Build the package
pip install build twine
python -m build
This creates distribution files in the dist/ directory.
Test with TestPyPI (recommended first)
# Upload to TestPyPI
python -m twine upload --repository testpypi dist/*
# Install from TestPyPI to test
pip install --index-url https://test.pypi.org/simple/ wisent-plots
Publish to PyPI
python -m twine upload dist/*
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues and questions, please open an issue on the GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wisent_visuals-0.1.0.tar.gz.
File metadata
- Download URL: wisent_visuals-0.1.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f21a899c6c3c8dac635adf0f5ac303093644f46638c7aaf4cc5e7b3dcb39e45
|
|
| MD5 |
98dace43e29d976520daaf7a776f7ea8
|
|
| BLAKE2b-256 |
385b70f9f3807d9634abe5d9a5710a63c09e87fc28d50d44c855209a8088a121
|
File details
Details for the file wisent_visuals-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wisent_visuals-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76a79a38eea52478caa9ff3fb8a3845af820216d314fda4d41ca4aba9d326385
|
|
| MD5 |
c9391e982d9c9880aad04046c6c35097
|
|
| BLAKE2b-256 |
33e8926ad884f18c3a53a5a8b0b26afe1ad686c6add597380420a8441fa0233c
|