YuMeow's personal matplotlib wrappers for academic and daily use.
Project description
🐾 yumeow-plot
YuMeow's personal matplotlib wrappers for academic and daily use.
yumeow-plot 是一套专为科研绘图设计的 Matplotlib 封装库。它专注于解决论文投稿中常见的物理尺寸对齐、空间布局分配等痛点。
✨ 核心特性
- 📏 精确尺寸求解 (Sizing Solver):直接使用厘米 (cm) 定义画布或子图大小,自动计算间距,完美适配不同期刊会议的分栏要求。
- 🧠 空间感应轴 (Space-aware Axes):通过
ax.get_side_rect()探测子图周边区域,实现 Colorbar 或标注区域的毫米级对齐。 - 🧩 智能合并布局 (Smart Merging):告别复杂的 GridSpec,通过
merge_axes像 Excel 合并单元格一样调整布局。 - 🛡️ 局部样式隔离:使用局部
rc_context应用学术风配置,绝不污染全局绘图设置。 - 📈 高阶可视化补丁:内置
plot_resilience(相平面韧性分析) 和plotOD(地理流向图) 等高级功能。
🚀 快速开始
安装
pip install yumeow-plot
基础用法:精确控制子图尺寸
import yumeow_plot as ym
import matplotlib.pyplot as plt
# 创建一个 1x2 布局,强制每个子图宽度为 4cm,高度按比例自动计算
fig, axes = ym.get_fig(1, 2, AW=4, A_ratio=1.2)
axes[0].plot([1, 2, 3], [4, 5, 6])
axes[1].scatter([1, 2, 3], [6, 5, 4])
# 在子图右侧自动分配一个 0.2cm 宽的区域放置 Colorbar
cax_rect = axes[1].get_side_rect(side='right', fixed_cm=0.2, pad_cm=0.1)
cax = fig.add_axes(cax_rect)
进阶:合并子图
# 生成 3x3 网格
fig, axes = ym.get_fig(3, 3, AW=3, AH=3)
# 将左上角 2x2 的子图合并为一个大图
big_ax = ym.merge_axes(axes.reshape(3,3)[:2, :2])
# 大图依然保留空间探测能力
title_rect = big_ax.get_side_rect(side='top', fixed_cm=0.5)
🎨 高级可视化
韧性分析图 (Resilience Plot)
针对二维系统动态特性的快速可视化工具。
from yumeow_plot import plot_resilience
f = lambda x, y: y - 3*y**2 - y**3 + x*y**3
plot_resilience(f, extent=(0, 5, 0, 5))
地理流向图 (OD Flow)
支持多种曲线样式的起终点流量可视化。
from yumeow_plot import plotOD
# 支持 'straight', 'parabola', 'rotated_parabola' 等多种轨迹
plotOD(ax, source, destination, flow, location, linetype='parabola')
📂 项目结构
yumeow-plot/
├── yumeow_plot/
│ ├── figure.py # get_fig, merge_axes (物理布局)
│ ├── layout.py # get_side_rect, get_margin_rect (空间探测)
│ ├── utils.py # 字体加载与底层转换
│ └── advanced_viz/ # 高级绘图函数 (OD, Resilience)
├── demo/ # 示例代码目录
├── pyproject.toml # 项目元数据
└── LICENSE # MIT License
⚖️ License
本项目采用 MIT License。
Copyright (c) 2026 YuMeow。
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 yumeow_plot-0.1.2.tar.gz.
File metadata
- Download URL: yumeow_plot-0.1.2.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eee1008fbf29bbe1c4ec60798b3013230122970246b8c13ffe245a0a2ab00d21
|
|
| MD5 |
0432b8a93442f7942ec8c3c57e39b477
|
|
| BLAKE2b-256 |
5d90b44c2ddd428361e3b1851e20f519fe8aad68aabba1852b657ed5bc5c58b1
|
Provenance
The following attestation bundles were made for yumeow_plot-0.1.2.tar.gz:
Publisher:
pypi.yml on yuzhTHU/yumeow-plot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yumeow_plot-0.1.2.tar.gz -
Subject digest:
eee1008fbf29bbe1c4ec60798b3013230122970246b8c13ffe245a0a2ab00d21 - Sigstore transparency entry: 1107900312
- Sigstore integration time:
-
Permalink:
yuzhTHU/yumeow-plot@795dd0cc62a22890751556277b3a6a88b45fd413 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/yuzhTHU
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@795dd0cc62a22890751556277b3a6a88b45fd413 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yumeow_plot-0.1.2-py2.py3-none-any.whl.
File metadata
- Download URL: yumeow_plot-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ffabde73562e13a2227c35870e1bb569291e07b3ca76b7339ebda768fc6927a
|
|
| MD5 |
52a6bad6db6edb7c5ec77baceadb9bfb
|
|
| BLAKE2b-256 |
45544c86036b2bdc74f7de71f5cc782270a26728c1ecfdca8bf5a9bca9531f01
|
Provenance
The following attestation bundles were made for yumeow_plot-0.1.2-py2.py3-none-any.whl:
Publisher:
pypi.yml on yuzhTHU/yumeow-plot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yumeow_plot-0.1.2-py2.py3-none-any.whl -
Subject digest:
6ffabde73562e13a2227c35870e1bb569291e07b3ca76b7339ebda768fc6927a - Sigstore transparency entry: 1107900313
- Sigstore integration time:
-
Permalink:
yuzhTHU/yumeow-plot@795dd0cc62a22890751556277b3a6a88b45fd413 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/yuzhTHU
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@795dd0cc62a22890751556277b3a6a88b45fd413 -
Trigger Event:
push
-
Statement type: