🐾 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。
Metadata
Release files for yumeow-plot 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yumeow_plot-0.1.2.tar.gz | 11.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yumeow_plot-0.1.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 24.4 kB
Release files / yumeow_plot-0.1.2.tar.gz
| Download URL | yumeow_plot-0.1.2.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eee1008fbf29bbe1c4ec60798b3013230122970246b8c13ffe245a0a2ab00d21
|
|
BLAKE2b-256 checksum How to use checksums |
5d90b44c2ddd428361e3b1851e20f519fe8aad68aabba1852b657ed5bc5c58b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 15, 2026.
Transparency logRelease files / yumeow_plot-0.1.2-py2.py3-none-any.whl
| Download URL | yumeow_plot-0.1.2-py2.py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6ffabde73562e13a2227c35870e1bb569291e07b3ca76b7339ebda768fc6927a
|
|
BLAKE2b-256 checksum How to use checksums |
45544c86036b2bdc74f7de71f5cc782270a26728c1ecfdca8bf5a9bca9531f01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 15, 2026.
Transparency log