plotfig


Nameplotfig JSON
Version 1.5.1 PyPI version JSON
download
home_pageNone
SummaryScientific plotting package for Cognitive neuroscience
upload_time2025-08-11 15:47:48
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords neuroscience plotting visualization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 简介

`plotfig` 是一个专为科学数据可视化设计的 Python 库,致力于为认知神经科研工作人员提供高效、易用且美观的图形绘制工具。
该项目基于业界主流的可视化库—— `matplotlib`、`surfplot` 和 `plotly` 开发,融合了三者的强大功能,能够满足神经科学、脑连接组学、相关性分析、矩阵可视化等多种科研场景下的复杂绘图需求。

![plotfig](https://github.com/RicardoRyn/plotfig/blob/main/docs/assets/plotfig.png)


## 项目结构

项目采用模块化设计,核心代码位于 `src/plotfig/` 目录下,包含如下主要功能模块:

- `bar.py`:条形图绘制,适用于分组数据的对比展示。
- `correlation.py`:相关性矩阵可视化,便于分析变量间的相关性分布。
- `matrix.py`:通用矩阵可视化,支持多种配色和注释方式。
- `brain_surface.py`:脑表面可视化,利用 `surfplot` 实现三维脑表面图集结构的绘制。
- `brain_connection.py`:玻璃脑连接可视化,支持复杂的脑网络结构展示。
- `circos.py`:环状图(Circos)绘制,适合平面展示脑区之间的连接关系。


## 文档与示例

`plotfig` 提供了网页文档和使用示例。具体参见[使用教程](https://ricardoryn.github.io/plotfig/)。

`plotfig` API 设计简洁,参数灵活,适合科研人员和数据分析师快速集成到自己的数据分析流程中。
其模块化架构便于后续功能扩展和自定义开发。
结合 `matplotlib` 支持矢量图或高分辨率位图和交互式 HTML 输出,适合论文发表和学术展示。

# 安装

## 普通安装

`plotfig` 支持通过 `pip` 或源码安装,要求 Python 3.11 及以上版本。


**使用 pip 安装 <small>(推荐)</small>**

```bash
pip install plotfig
```

**使用 GitHub 源码安装**

```bash
git clone --depth 1 https://github.com/RicardoRyn/plotfig.git
cd plotfig
pip install .
```

## 依赖要求

`plotfig` 依赖若干核心库,这些依赖将在安装过程中自动处理:

- [matplotlib](https://matplotlib.org/) ≥ 3.10.1
- [mne-connectivity](https://mne.tools/mne-connectivity/stable/index.html) ≥ 0.7.0
- [nibabel](https://nipy.org/nibabel/) ≥ 5.3.2
- [numpy](https://numpy.org/) ≥ 2.2.4
- [pandas](https://pandas.pydata.org/) ≥ 2.2.3
- [plotly](https://plotly.com/) ≥ 6.1.1
- [kaleido](https://github.com/plotly/Kaleido) ≥ 1.0.0
- [scipy](https://scipy.org/) ≥ 1.15.2
- [loguru](https://loguru.readthedocs.io/en/stable/) ≥ 0.7.3
- [surfplot](https://github.com/danjgale/surfplot) 需使用其 GitHub 仓库中的最新版,而非 PyPI 上的版本,因后者尚未包含所需功能。

> ⚠️ **指定 `surfplot` 版本**
>
> 由于 PyPI 上的 `surfplot` 版本较旧,缺少 `plotfig` 所需功能,建议通过以下步骤安装其 GitHub 仓库的最新版:
>
> ```bash
> # 卸载旧版本
> pip uninstall surfplot
>
> # 克隆源码并安装
> git clone --depth 1 https://github.com/danjgale/surfplot.git
> cd surfplot
> pip install .
>
> # 安装完成后,返回上级目录并删除源码文件夹
> cd ..
> rm -rf surfplot
> ```

## 贡献指南

如果您希望参与 `plotfig` 的开发,或者想体验尚未正式发布的新功能和最新修复的 bug,可以选择以开发模式安装项目。

这种“可编辑模式(editable mode)”安装方式允许您对本地源码的修改立即生效,非常适合开发、调试和贡献代码。

推荐先 Fork 仓库,然后克隆您自己的 Fork:

```bash
git clone -b dev https://github.com/<your-username>/plotfig.git
cd plotfig
pip install -e .
```

**欢迎提交 Issue 或 PR!**

无论是 Bug 报告、功能建议,还是文档改进,都非常欢迎你的参与。
如果你在使用过程中遇到了问题,或者有更好的想法,欢迎在 [Issue](https://github.com/RicardoRyn/plotfig/issues) 中提出。
也可以直接提交 [PR](https://github.com/RicardoRyn/plotfig/pulls),一起变得更强 🙌!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "plotfig",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "neuroscience, plotting, visualization",
    "author": null,
    "author_email": "Ricardo Ryn <ricardoRyn1317@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/42/b7/fdb4cdc7b642a60eed4f9a7d5a4bb821bea8fc3ecac9a2588e351f550e66/plotfig-1.5.1.tar.gz",
    "platform": null,
    "description": "# \u7b80\u4ecb\n\n`plotfig` \u662f\u4e00\u4e2a\u4e13\u4e3a\u79d1\u5b66\u6570\u636e\u53ef\u89c6\u5316\u8bbe\u8ba1\u7684 Python \u5e93\uff0c\u81f4\u529b\u4e8e\u4e3a\u8ba4\u77e5\u795e\u7ecf\u79d1\u7814\u5de5\u4f5c\u4eba\u5458\u63d0\u4f9b\u9ad8\u6548\u3001\u6613\u7528\u4e14\u7f8e\u89c2\u7684\u56fe\u5f62\u7ed8\u5236\u5de5\u5177\u3002\n\u8be5\u9879\u76ee\u57fa\u4e8e\u4e1a\u754c\u4e3b\u6d41\u7684\u53ef\u89c6\u5316\u5e93\u2014\u2014 `matplotlib`\u3001`surfplot` \u548c `plotly` \u5f00\u53d1\uff0c\u878d\u5408\u4e86\u4e09\u8005\u7684\u5f3a\u5927\u529f\u80fd\uff0c\u80fd\u591f\u6ee1\u8db3\u795e\u7ecf\u79d1\u5b66\u3001\u8111\u8fde\u63a5\u7ec4\u5b66\u3001\u76f8\u5173\u6027\u5206\u6790\u3001\u77e9\u9635\u53ef\u89c6\u5316\u7b49\u591a\u79cd\u79d1\u7814\u573a\u666f\u4e0b\u7684\u590d\u6742\u7ed8\u56fe\u9700\u6c42\u3002\n\n![plotfig](https://github.com/RicardoRyn/plotfig/blob/main/docs/assets/plotfig.png)\n\n\n## \u9879\u76ee\u7ed3\u6784\n\n\u9879\u76ee\u91c7\u7528\u6a21\u5757\u5316\u8bbe\u8ba1\uff0c\u6838\u5fc3\u4ee3\u7801\u4f4d\u4e8e `src/plotfig/` \u76ee\u5f55\u4e0b\uff0c\u5305\u542b\u5982\u4e0b\u4e3b\u8981\u529f\u80fd\u6a21\u5757\uff1a\n\n- `bar.py`\uff1a\u6761\u5f62\u56fe\u7ed8\u5236\uff0c\u9002\u7528\u4e8e\u5206\u7ec4\u6570\u636e\u7684\u5bf9\u6bd4\u5c55\u793a\u3002\n- `correlation.py`\uff1a\u76f8\u5173\u6027\u77e9\u9635\u53ef\u89c6\u5316\uff0c\u4fbf\u4e8e\u5206\u6790\u53d8\u91cf\u95f4\u7684\u76f8\u5173\u6027\u5206\u5e03\u3002\n- `matrix.py`\uff1a\u901a\u7528\u77e9\u9635\u53ef\u89c6\u5316\uff0c\u652f\u6301\u591a\u79cd\u914d\u8272\u548c\u6ce8\u91ca\u65b9\u5f0f\u3002\n- `brain_surface.py`\uff1a\u8111\u8868\u9762\u53ef\u89c6\u5316\uff0c\u5229\u7528 `surfplot` \u5b9e\u73b0\u4e09\u7ef4\u8111\u8868\u9762\u56fe\u96c6\u7ed3\u6784\u7684\u7ed8\u5236\u3002\n- `brain_connection.py`\uff1a\u73bb\u7483\u8111\u8fde\u63a5\u53ef\u89c6\u5316\uff0c\u652f\u6301\u590d\u6742\u7684\u8111\u7f51\u7edc\u7ed3\u6784\u5c55\u793a\u3002\n- `circos.py`\uff1a\u73af\u72b6\u56fe\uff08Circos\uff09\u7ed8\u5236\uff0c\u9002\u5408\u5e73\u9762\u5c55\u793a\u8111\u533a\u4e4b\u95f4\u7684\u8fde\u63a5\u5173\u7cfb\u3002\n\n\n## \u6587\u6863\u4e0e\u793a\u4f8b\n\n`plotfig` \u63d0\u4f9b\u4e86\u7f51\u9875\u6587\u6863\u548c\u4f7f\u7528\u793a\u4f8b\u3002\u5177\u4f53\u53c2\u89c1[\u4f7f\u7528\u6559\u7a0b](https://ricardoryn.github.io/plotfig/)\u3002\n\n`plotfig` API \u8bbe\u8ba1\u7b80\u6d01\uff0c\u53c2\u6570\u7075\u6d3b\uff0c\u9002\u5408\u79d1\u7814\u4eba\u5458\u548c\u6570\u636e\u5206\u6790\u5e08\u5feb\u901f\u96c6\u6210\u5230\u81ea\u5df1\u7684\u6570\u636e\u5206\u6790\u6d41\u7a0b\u4e2d\u3002\n\u5176\u6a21\u5757\u5316\u67b6\u6784\u4fbf\u4e8e\u540e\u7eed\u529f\u80fd\u6269\u5c55\u548c\u81ea\u5b9a\u4e49\u5f00\u53d1\u3002\n\u7ed3\u5408 `matplotlib` \u652f\u6301\u77e2\u91cf\u56fe\u6216\u9ad8\u5206\u8fa8\u7387\u4f4d\u56fe\u548c\u4ea4\u4e92\u5f0f HTML \u8f93\u51fa\uff0c\u9002\u5408\u8bba\u6587\u53d1\u8868\u548c\u5b66\u672f\u5c55\u793a\u3002\n\n# \u5b89\u88c5\n\n## \u666e\u901a\u5b89\u88c5\n\n`plotfig` \u652f\u6301\u901a\u8fc7 `pip` \u6216\u6e90\u7801\u5b89\u88c5\uff0c\u8981\u6c42 Python 3.11 \u53ca\u4ee5\u4e0a\u7248\u672c\u3002\n\n\n**\u4f7f\u7528 pip \u5b89\u88c5 <small>(\u63a8\u8350)</small>**\n\n```bash\npip install plotfig\n```\n\n**\u4f7f\u7528 GitHub \u6e90\u7801\u5b89\u88c5**\n\n```bash\ngit clone --depth 1 https://github.com/RicardoRyn/plotfig.git\ncd plotfig\npip install .\n```\n\n## \u4f9d\u8d56\u8981\u6c42\n\n`plotfig` \u4f9d\u8d56\u82e5\u5e72\u6838\u5fc3\u5e93\uff0c\u8fd9\u4e9b\u4f9d\u8d56\u5c06\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u81ea\u52a8\u5904\u7406\uff1a\n\n- [matplotlib](https://matplotlib.org/) \u2265 3.10.1\n- [mne-connectivity](https://mne.tools/mne-connectivity/stable/index.html) \u2265 0.7.0\n- [nibabel](https://nipy.org/nibabel/) \u2265 5.3.2\n- [numpy](https://numpy.org/) \u2265 2.2.4\n- [pandas](https://pandas.pydata.org/) \u2265 2.2.3\n- [plotly](https://plotly.com/) \u2265 6.1.1\n- [kaleido](https://github.com/plotly/Kaleido) \u2265 1.0.0\n- [scipy](https://scipy.org/) \u2265 1.15.2\n- [loguru](https://loguru.readthedocs.io/en/stable/) \u2265 0.7.3\n- [surfplot](https://github.com/danjgale/surfplot) \u9700\u4f7f\u7528\u5176 GitHub \u4ed3\u5e93\u4e2d\u7684\u6700\u65b0\u7248\uff0c\u800c\u975e PyPI \u4e0a\u7684\u7248\u672c\uff0c\u56e0\u540e\u8005\u5c1a\u672a\u5305\u542b\u6240\u9700\u529f\u80fd\u3002\n\n> \u26a0\ufe0f **\u6307\u5b9a `surfplot` \u7248\u672c**\n>\n> \u7531\u4e8e PyPI \u4e0a\u7684 `surfplot` \u7248\u672c\u8f83\u65e7\uff0c\u7f3a\u5c11 `plotfig` \u6240\u9700\u529f\u80fd\uff0c\u5efa\u8bae\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b89\u88c5\u5176 GitHub \u4ed3\u5e93\u7684\u6700\u65b0\u7248\uff1a\n>\n> ```bash\n> # \u5378\u8f7d\u65e7\u7248\u672c\n> pip uninstall surfplot\n>\n> # \u514b\u9686\u6e90\u7801\u5e76\u5b89\u88c5\n> git clone --depth 1 https://github.com/danjgale/surfplot.git\n> cd surfplot\n> pip install .\n>\n> # \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8fd4\u56de\u4e0a\u7ea7\u76ee\u5f55\u5e76\u5220\u9664\u6e90\u7801\u6587\u4ef6\u5939\n> cd ..\n> rm -rf surfplot\n> ```\n\n## \u8d21\u732e\u6307\u5357\n\n\u5982\u679c\u60a8\u5e0c\u671b\u53c2\u4e0e `plotfig` \u7684\u5f00\u53d1\uff0c\u6216\u8005\u60f3\u4f53\u9a8c\u5c1a\u672a\u6b63\u5f0f\u53d1\u5e03\u7684\u65b0\u529f\u80fd\u548c\u6700\u65b0\u4fee\u590d\u7684 bug\uff0c\u53ef\u4ee5\u9009\u62e9\u4ee5\u5f00\u53d1\u6a21\u5f0f\u5b89\u88c5\u9879\u76ee\u3002\n\n\u8fd9\u79cd\u201c\u53ef\u7f16\u8f91\u6a21\u5f0f\uff08editable mode\uff09\u201d\u5b89\u88c5\u65b9\u5f0f\u5141\u8bb8\u60a8\u5bf9\u672c\u5730\u6e90\u7801\u7684\u4fee\u6539\u7acb\u5373\u751f\u6548\uff0c\u975e\u5e38\u9002\u5408\u5f00\u53d1\u3001\u8c03\u8bd5\u548c\u8d21\u732e\u4ee3\u7801\u3002\n\n\u63a8\u8350\u5148 Fork \u4ed3\u5e93\uff0c\u7136\u540e\u514b\u9686\u60a8\u81ea\u5df1\u7684 Fork\uff1a\n\n```bash\ngit clone -b dev https://github.com/<your-username>/plotfig.git\ncd plotfig\npip install -e .\n```\n\n**\u6b22\u8fce\u63d0\u4ea4 Issue \u6216 PR\uff01**\n\n\u65e0\u8bba\u662f Bug \u62a5\u544a\u3001\u529f\u80fd\u5efa\u8bae\uff0c\u8fd8\u662f\u6587\u6863\u6539\u8fdb\uff0c\u90fd\u975e\u5e38\u6b22\u8fce\u4f60\u7684\u53c2\u4e0e\u3002\n\u5982\u679c\u4f60\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u9047\u5230\u4e86\u95ee\u9898\uff0c\u6216\u8005\u6709\u66f4\u597d\u7684\u60f3\u6cd5\uff0c\u6b22\u8fce\u5728 [Issue](https://github.com/RicardoRyn/plotfig/issues) \u4e2d\u63d0\u51fa\u3002\n\u4e5f\u53ef\u4ee5\u76f4\u63a5\u63d0\u4ea4 [PR](https://github.com/RicardoRyn/plotfig/pulls)\uff0c\u4e00\u8d77\u53d8\u5f97\u66f4\u5f3a \ud83d\ude4c\uff01\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Scientific plotting package for Cognitive neuroscience",
    "version": "1.5.1",
    "project_urls": null,
    "split_keywords": [
        "neuroscience",
        " plotting",
        " visualization"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8f20b5404e2e1558c966694f991d8b1cdd0df2b751ba256add97311df61ba54a",
                "md5": "7546b38a117ef117ade1b0736ef071fb",
                "sha256": "a3c7a39fd990764a90b6bffa2a03f66a5e23238c6ac70f41ef6525da956d75c9"
            },
            "downloads": -1,
            "filename": "plotfig-1.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7546b38a117ef117ade1b0736ef071fb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 24322948,
            "upload_time": "2025-08-11T15:47:45",
            "upload_time_iso_8601": "2025-08-11T15:47:45.594330Z",
            "url": "https://files.pythonhosted.org/packages/8f/20/b5404e2e1558c966694f991d8b1cdd0df2b751ba256add97311df61ba54a/plotfig-1.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "42b7fdb4cdc7b642a60eed4f9a7d5a4bb821bea8fc3ecac9a2588e351f550e66",
                "md5": "72df483b5b8c6c96d5a6c0f40b2872b3",
                "sha256": "b8480e0a0b3b1e3a867632fad259967e7506b68528b104ee052908f2bc1b7fe8"
            },
            "downloads": -1,
            "filename": "plotfig-1.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "72df483b5b8c6c96d5a6c0f40b2872b3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 31093209,
            "upload_time": "2025-08-11T15:47:48",
            "upload_time_iso_8601": "2025-08-11T15:47:48.724933Z",
            "url": "https://files.pythonhosted.org/packages/42/b7/fdb4cdc7b642a60eed4f9a7d5a4bb821bea8fc3ecac9a2588e351f550e66/plotfig-1.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-11 15:47:48",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "plotfig"
}
        
Elapsed time: 3.77804s