Pubfig
Publication-style scientific plotting for papers: common plot families, clean exports, and panel-first Figma assembly.
Install / Use
/learn @Galaxy-Dawn/PubfigREADME
pubfig
<div align="center"> <img src="LOGO.png" alt="pubfig logo" width="100%"/> <p> <img src="https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.10+"/> <a href="https://pypi.org/project/pubfig/"><img src="https://img.shields.io/pypi/v/pubfig?style=flat-square&logo=pypi&logoColor=white" alt="PyPI version"/></a> <a href="https://pypi.org/project/pubfig/"><img src="https://img.shields.io/badge/pip%20install-pubfig-3775A9?style=flat-square&logo=pypi&logoColor=white" alt="pip install pubfig"/></a> <img src="https://img.shields.io/badge/Matplotlib-3.8%2B-11557C?style=flat-square" alt="Matplotlib 3.8+"/> <img src="https://img.shields.io/badge/License-MIT-green?style=flat-square" alt="License"/> <a href="https://github.com/Galaxy-Dawn/pubfig"><img src="https://img.shields.io/github/stars/Galaxy-Dawn/pubfig?style=flat-square" alt="GitHub Stars"/></a> </p><strong>Language</strong>: <a href="https://github.com/Galaxy-Dawn/pubfig/blob/main/README.md">English</a> | <a href="https://github.com/Galaxy-Dawn/pubfig/blob/main/README.zh-CN.md">中文</a>
</div>Publication-style figures for papers, from single plots to panel-first Figma assembly.
pubfig is a Matplotlib-native plotting library for researchers who want figures that already look close to the final paper figure. It combines common scientific plot families, journal-aware export, and a panel-first Figma workflow for assembling large multi-panel figures without rebuilding artwork by hand.
Project links: PyPI · GitHub · Examples
Highlights
- Paper-Ready Defaults, Not a Blank Canvas — Titles, legends, fonts, line widths, and spacing start from a more publication-like baseline.
- Common Scientific Plot Families in One API — Statistical plots, distributions, trends, dimensionality reduction, evaluation curves, heatmaps, and flow plots live in one consistent surface.
- Journal-Aware Export Without Boilerplate —
save_figure(...)andbatch_export(...)handle explicit output suffixes, column widths, DPI, and trimming directly. - Panel-First Workflow for Composite Figures — Export clean subplot assets, then assemble and refresh full figures in Figma instead of re-drawing panels manually.
- Matplotlib-Native and Script-Friendly — Plot functions return standard Matplotlib
Figureobjects, so they drop into existing analysis code easily.
Recent News
- 2026-03-31:
pubfig 0.2.2adds ECDF, QQ, Bland–Altman, Calibration, and UpSet, and brings them into the homepage showcase and full gallery. - 2026-03-30:
pubfig 0.2.1refreshed the PyPI release with stronger polar/composition coverage and fuller gallery examples. - 2026-03-29:
pubfig 0.2.0landed on PyPI withpip install pubfig, suffix-based export, and the documented panel-first Figma workflow.
- 2026-03-25: Panel-first Figma loop polish — panel export now defaults to title-free assets for cleaner Figma assembly,
pubfig-syncnow keeps shared title / legend placeholders off by default, and bridge/watch flows now surface bundle provenance plus the exact manual-fallback bundle path. - 2026-03-20: Local bridge automation for Figma sync — added a bridge-backed
pubfig figma bridge|sync|watchworkflow, upgradedpubfig-syncwith bridge connection mode, and enabled CLI-triggered vector import/refresh after one-time plugin connection. - 2026-03-20: Figma plugin v2 workflow polish — added
auto/hero_toprelayout presets, upgraded shared title / legend placeholders, and improved refresh behavior so manual Figma positioning is preserved more reliably unless relayout is requested. - 2026-03-20: CLI + Figma plugin workflow — added
pubfig figma package|validate|inspect, introduced a single-file Figma bundle JSON format for exported panels, and scaffolded thefigma-plugin/pubfig-syncplugin for node-level import and refresh. - 2026-03-20: Figma-first panel export workflow — added
export_panel(...)andexport_panels(...)for stable subplot asset export, introduced a minimalpanel-index.jsonsync index, and documented the Codex + Figma MCP refinement path for multi-panel figures. - 2026-03-20: README alignment with pubtab style and homepage refresh — reorganized the README into a pubtab-style homepage with centered badges, language switch, highlights, dated recent news, showcase examples, and an embedded gallery hero.
- 2026-03-20: Default full install and metadata simplification — changed
pip install pubfigto install the full plotting stack by default, removed user-facing extras from the main install path, and aligned package metadata, GitHub About, and README wording. - 2026-03-19: Raincloud plot support and gallery refresh — added
raincloud(...), tuned its default styling, integrated it into the gallery, and regenerated the exported figure set. - 2026-03-19: PCA biplot and radar default updates — expanded
pca_biplot(...)with loading panel modes and group ellipses, refreshed radar defaults, unified font handling, and re-exported the gallery.
Examples
Showcase
Single-plot examples
<p align="center"> <a href="examples/bar_scatter.png"><img src="examples/bar_scatter.png" width="32%" alt="Bar scatter example"></a> <a href="examples/raincloud.png"><img src="examples/raincloud.png" width="32%" alt="Raincloud example"></a> <a href="examples/line.png"><img src="examples/line.png" width="32%" alt="Line example"></a> </p> <p align="center"> <a href="examples/radar.png"><img src="examples/radar.png" width="32%" alt="Radar example"></a> <a href="examples/scatter.png"><img src="examples/scatter.png" width="32%" alt="Scatter example"></a> <a href="examples/heatmap.png"><img src="examples/heatmap.png" width="32%" alt="Heatmap example"></a> </p>New plot families
<p align="center"> <a href="examples/ecdf.png"><img src="examples/ecdf.png" width="32%" alt="ECDF example"></a> <a href="examples/qq.png"><img src="examples/qq.png" width="32%" alt="QQ plot example"></a> <a href="examples/bland_altman.png"><img src="examples/bland_altman.png" width="32%" alt="Bland-Altman example"></a> </p> <p align="center"> <a href="examples/calibration.png"><img src="examples/calibration.png" width="48%" alt="Calibration example"></a> <a href="examples/upset.png"><img src="examples/upset.png" width="48%" alt="UpSet example"></a> </p> <p align="center"> <a href="examples/dumbbell.png"><img src="examples/dumbbell.png" width="48%" alt="Dumbbell example"></a> <a href="examples/forest_plot.png"><img src="examples/forest_plot.png" width="48%" alt="Forest plot example"></a> </p> <p align="center"> <a href="examples/hexbin.png"><img src="examples/hexbin.png" width="48%" alt="Hexbin example"></a> <a href="examples/volcano.png"><img src="examples/volcano.png" width="48%" alt="Volcano example"></a> </p> <p align="center"> <a href="examples/grouped_scatter.png"><img src="examples/grouped_scatter.png" width="48%" alt="Grouped scatter example"></a> <a href="examples/radial_hierarchy.png"><img src="examples/radial_hierarchy.png" width="48%" alt="Radial hierarchy example"></a> </p> <p align="center"> <a href="examples/circular_stacked_bar.png"><img src="examples/circular_stacked_bar.png" width="48%" alt="Circular stacked bar example"></a> <a href="examples/circular_grouped_bar.png"><img src="examples/circular_grouped_bar.png" width="48%" alt="Circular grouped bar example"></a> </p>Composite figure examples assembled in Figma
<p align="center"> <a href="examples/composite-showcase-benchmark.png"><img src="examples/composite-showcase-benchmark.png" width="96%" alt="Benchmark composite figure assembled in Figma"></a> </p> <p align="center"> <a href="examples/composite-showcase-intervention.png"><img src="examples/composite-showcase-intervention.png" width="96%" alt="Intervention composite figure assembled in Figma"></a> </p> <p align="center"> <a href="examples/composite-showcase-stratification.png"><img src="examples/composite-showcase-stratification.png" width="96%" alt="Stratification composite figure assembled in Figma"></a> </p> <details> <summary><strong>Full Gallery</strong></summary>The full gallery below also includes the newest diagnostics, evaluation, and set/composition families such as ECDF, QQ, Bland–Altman, Calibration, and UpSet.
<p align="center"> <img src="examples/gallery-hero.png" width="100%" alt="Full gallery contact sheet"> </p> </details>Quick Start
pip install pubfig
Python Quick Start
Start with the fewest possible parameters first:
import numpy as np
import pubfig as pf
rng = np.random.default_rng(0)
means = np.array([
[0.78, 0.96],
[0.88, 1.08],
[0.84, 1.00],
], dtype=float)
data = rng.normal(loc=means[..., None], scale=0.08, size=(3, 2, 18))
data = np.clip(data, 0.0, None)
fig = pf.bar_scatter(data)
pf.save_figure(fig, "figure1.pdf")
This is enough to get your first figure out. You do not need to understand layout, export, or publication-specific parameters before the first run.
Most common next parameters
Once the minimal example works, these are usually the first parameters worth adding:
fig = pf.bar_scatter(
data,
category_names=["Condition A", "Condition B", "Condition C"],
series_names=["Ctrl", "Treatment"],
title="Bar + Scatter",
)
pf.save_figure(fig, "figure1.pdf", spec="nature", width="single")
category_names: names on the x-axisseries_names: names in the legendtitle: figure titlespec/width: journal-style export presets
Only add parameters like aspect_ratio or trim when you already know why you
need them.
Where to look up detailed parameters
If you want to unde
Related Skills
claude-opus-4-5-migration
109.8kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
349.9kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
TrendRadar
51.0k⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。
mcp-for-beginners
15.8kThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
