An advanced and flexible scientific plotting toolkit.
Project description
English | ไธญๆ
boviz
boviz is an advanced Python toolkit designed for generating publication-quality scientific figures with minimal code. Built on top of Matplotlib, it simplifies the creation of complex plots like multi-curve comparisons, dual-axis charts, heatmaps, and schematic diagrams, all while automatically applying academic styling conventions.
โจ Key Features
- Publication-Ready Aesthetics: Automatically applies academic font styles (e.g., Times New Roman) and optimizes tick marks, labels, and legends for high-resolution output.
- Streamlined Workflow:
- CSV to Plot: The
boviz.curvesmodule allows you to generate complex comparison plots directly from CSV files with a single function call. - NumPy Support: Easily plot data directly from NumPy arrays.
- CSV to Plot: The
- Advanced Plotting Capabilities:
- Residual Analysis: Automatically calculate and visualize the difference between experimental and simulation data.
- Dual Y-Axis: Effortlessly create plots with two different Y-axes.
- Heatmaps & Fields: Visualize 2D fields (e.g., from finite element analysis) with
boviz.heatmap. - Schematics: Generate academic-style schematic diagrams (e.g., particle distributions) with
boviz.schematic.
- Automated Versioning: Uses
setuptools_scmfor seamless version management based on Git tags.
๐ฆ Installation
pip install boviz
Or, to install the development or latest version from source:
# Clone the repository
git clone https://github.com/bo-qian/boviz.git
cd boviz
# (Optional) Create a virtual environment
python -m venv venv && source venv/bin/activate
# Install the package from source
pip install .
๐ Usage
For detailed API documentation, tutorials, and more examples, please visit the official documentation: ๐ https://boviz.readthedocs.io/zh-cn/latest/
You can quickly scaffold a new boviz-based project using the built-in CLI:
boviz init my_project
This command creates a new directory my_project with a recommended structure, including example scripts and configuration files. It helps you get started with best practices for organizing your plotting workflow.
Generated structure:
my_project/
โโโ data/
โ โโโ example.csv
โโโ plot.py
After initialization, you can immediately start adding your data and scripts, and use boviz's plotting functions as shown below.
๐ Quick Example
from boviz import *
# Plot initial particle distribution schematic
plot_initial_particle_schematic(
coordinates=[[90, 90], [150, 90]],
radii=[30, 30],
domain=[240, 180],
title="Initial Particle Distribution",
show=True,
save=True
)
# Multiple feature curve plotting
plot_curves_csv(
path=["example/data/test_plotkit_multifeature_data.csv"] * 4,
label=["Exp 800K", "Exp 900K", "Sim 800K", "Sim 900K"],
x=[0, 0, 0, 0],
y=[1, 2, 3, 4],
xy_label=["Time (s)", "Shrinkage Ratio"],
title_figure="Shrinkage Comparison at Two Temperatures",
use_marker=[True, True, False, False],
legend_ncol=2,
save=True,
show=False
)
# Single curve plotting: Plot a single simulation curve
x = np.linspace(0, 4*np.pi, 200)
y = np.sin(x)
plot_curves(
data=[(x, y)],
label=["$\sin(x)$"],
xy_label=("$x$", "$\sin(x)$"),
title_figure="Sine Wave Example",
save=True,
show=True
)
# Particle heatmap example
plot_heatmap_particle(
particle_x_num=2,
particle_y_num=1,
particle_radius=30,
border=1,
cmap='coolwarm',
title_figure="Particle Heatmap Example",
save=True,
show=False
)
|
Initial Particle Distribution |
Shrinkage Comparison |
|
Sine Wave Example |
Particle Heatmap Example |
๐งช Testing
To run all tests, use:
python -m pytest
Note: On Windows, if you installed boviz in a Conda environment, make sure to run this command from the Conda terminal (Anaconda Prompt or your activated Conda shell), not from the default system terminal.
All core plotting functions are covered by unit tests under the tests/ directory, including:
- Curve plotting (single and multi-feature)
- Schematic particle distribution
- Residual comparison
- Style and legend configurations
๐ Project Structure
boviz/
โโโ src/
โ โโโ boviz/
โ โโโ __init__.py
โ โโโ __main__.py # Main entry point for the package
โ โโโ cli.py # Command-line interface for plotting
โ โโโ config.py # Global parameters and color sets
โ โโโ curves.py # Core curve plotting functions
โ โโโ schematic.py # Particle schematic functions
โ โโโ heatmap.py # Particle heatmap plotting
โ โโโ style.py # Default plot styling
โ โโโ utils.py # Filename generator and helpers
โโโ tests/ # Pytest-based test cases
โโโ example/ # Example scripts and CSV data
โ โโโ data/
โ โโโ test_example_plot.py
โโโ figures/ # Output figures (auto-generated)
โ โโโ ShowExample/ # Example figures for documentation
โโโ requirements.txt # Required dependencies
โโโ pyproject.toml # Build configuration
โโโ setup.py # Legacy install config
โโโ LICENSE
โโโ README.md
โโโ README_zh.md # Chinese version of the README
๐ Dependencies
matplotlib>=3.0
numpy>=1.18
pandas>=1.0
pytest>=6.0
pathlib>=1.0
argparse>=1.4.0
meshio>=4.0
netCDF4>=1.5
Install via:
pip install -r requirements.txt
๐ Contributing
Feel free to contribute by:
- Reporting issues and bugs
- Improving documentation and examples
- Submitting pull requests with enhancements or new plotting modules
All contributions are welcome and appreciated.
๐ License
GNU General Public License v3 (GPLv3) License ยฉ 2025 Bo Qian
For advanced examples and API documentation, please refer to the tests/ and example/ directories, or explore the docstrings inside the src/boviz/ module.
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 boviz-0.3.3.tar.gz.
File metadata
- Download URL: boviz-0.3.3.tar.gz
- Upload date:
- Size: 508.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2052c851f97fe3dac70bf625e7e8de05401b55d051eb848fb8c0c87c410da2f4
|
|
| MD5 |
6febc0c42bac3f596ed7874836f3a6cc
|
|
| BLAKE2b-256 |
fabe54ca6688230eac2d1b3578b7af1321fc97c01aee5749523f20fd34c0a5c8
|
Provenance
The following attestation bundles were made for boviz-0.3.3.tar.gz:
Publisher:
publish.yml on bo-qian/boviz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boviz-0.3.3.tar.gz -
Subject digest:
2052c851f97fe3dac70bf625e7e8de05401b55d051eb848fb8c0c87c410da2f4 - Sigstore transparency entry: 833546510
- Sigstore integration time:
-
Permalink:
bo-qian/boviz@024334838777a844a4a106c8e77020f29449eb10 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/bo-qian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@024334838777a844a4a106c8e77020f29449eb10 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boviz-0.3.3-py3-none-any.whl.
File metadata
- Download URL: boviz-0.3.3-py3-none-any.whl
- Upload date:
- Size: 64.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fc3f207655b108af51d0ead7821d9a3c3bf6e798b3fb9bc48b6061fd20a1d91
|
|
| MD5 |
2d73c4a5b6868bb2645504d54d6903ad
|
|
| BLAKE2b-256 |
a5c1cdc63cdb193d2c510fb07c6fd837d798256b3ec9c8628b1a20b72dd4a3b6
|
Provenance
The following attestation bundles were made for boviz-0.3.3-py3-none-any.whl:
Publisher:
publish.yml on bo-qian/boviz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boviz-0.3.3-py3-none-any.whl -
Subject digest:
9fc3f207655b108af51d0ead7821d9a3c3bf6e798b3fb9bc48b6061fd20a1d91 - Sigstore transparency entry: 833546513
- Sigstore integration time:
-
Permalink:
bo-qian/boviz@024334838777a844a4a106c8e77020f29449eb10 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/bo-qian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@024334838777a844a4a106c8e77020f29449eb10 -
Trigger Event:
push
-
Statement type: