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
Requires Python 3.10 or newer. Earlier metadata incorrectly advertised older Python versions despite the source using Python 3.10 syntax.
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 *
import numpy as np
# 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 pip install -e ".[test]"
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.
The tests cover CSV curve export, particle schematic export, automatic marker placement, spacing and grouping, dual-axis styles, and legacy parameter order. This is targeted regression coverage, not exhaustive coverage of all plotting APIs. Tests run headlessly and write figures to temporary directories. Local pytest uses the source tree; CI tests the installed package on Linux and Windows with Python 3.10–3.13, and builds the distribution and documentation.
Marker controls
import numpy as np
from boviz import plot_curves
x = np.linspace(0, 10, 501)
plot_curves(
data=[(x, np.sin(x)), (x, np.sin(x))],
label=["Experiment", "Simulation"],
xy_label=("Time", "Response"),
use_marker=[True, True],
marker_spacing="auto",
marker_group=[0, 1],
save=True,
)
marker_spacing="auto"uses phased marker placement with a nominal period of 0.12 of the axes diagonal; a positive number changes that fraction.marker_spacing=Nonemarks every data point. A two-number tuple specifies(offset_step, period)for Matplotlib's distance-basedmarkeverymode.marker_groupselects marker shapes independently ofcolor_group.plot_dual_curves_csvalso supportsmarker_group_right,line_style, andline_style_right.
Automatic placement uses a linear data-to-display approximation and selects existing samples; it does not guarantee uniform spacing on logarithmic axes or very sparsely sampled curves. See release notes.
📁 Project Structure
boviz/
├── src/
│ └── boviz/
│ ├── __init__.py
│ ├── 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/
│ └── 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
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.
See CONTRIBUTING.md for setup, testing, and release checks.
📜 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.
Metadata
Release files for boviz 0.3.4
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 |
|---|---|---|---|---|
| boviz-0.3.4.tar.gz | 520.1 kB | With provenance | Details for boviz-0.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| boviz-0.3.4-py3-none-any.whl | Python 3 | none | any | Details for boviz-0.3.4-py3-none-any.whl |
Total release size: 590.1 kB
Release files / boviz-0.3.4.tar.gz
| Download URL | boviz-0.3.4.tar.gz |
|---|---|
| Size | 520.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcee85fb3196163b4569900b6b1761745864407666a42e34f7a6f3d6c3417b0f
|
|
BLAKE2b-256 checksum How to use checksums |
6fc6e03ef7ec79ddcab3ae8735de7b3a22f9239157957f621cf2595c5abef032
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / boviz-0.3.4-py3-none-any.whl
| Download URL | boviz-0.3.4-py3-none-any.whl |
|---|---|
| Size | 70.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af5d1806643fb3d8dd6a2ddf1d8ca6f083530383cb1c6755ed65595fc150220b
|
|
BLAKE2b-256 checksum How to use checksums |
b710091ea0e57abc31d5fd0ec99a68c92e6b4a9eb480c21363c6719090cc9c5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logSecurity for boviz 0.3.4
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for boviz-0.3.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logA 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.