Skip to main content


KimariPlot 是一个开源的 Python 绘图脚本,用来绘制科研中的 Free Energy Profile。KimariPlot 使用简单,可以直接从命令行读取 Toml 文件绘制 Free Energy Profile,可以不需要用鼠标一直拖来拖去,是懒人绘制 Free Energy Profile 的极佳选择。

安装

KimariPlot 可以使用 pip 工具直接安装。

pip install kimariplot

与此同时还需要安装 matplotlib 以及 toml 库(暂时不需要安装 numpy 和 pandas 库,以后可能需要)。

pip install matplotlib, toml

使用

安装完 KimariPlot 之后,可以直接通过如下命令在命令行中运行。接着就会在当前目录下生成 figure.png 图像文件。profile.toml 是一个 toml 文件,用来记录颜色、曲线格式以及绘制所需要的数据。

kimariplot profile.toml

简要介绍一下 toml 文件所需要配置的内容。color 为折线颜色,style 为折线的格式,可以为 - 或 --。data 为数据的列表,里面可以包括很多个 3 字符串元素的列表。第一个字符串表示名字;第二个字符串表示反应的进度,一般从 1 开始;第三个字符串表示反应的 Free Energy 能垒,一般都用 kcal/mol 表示。

[[path]]
color = "black"
style = "-"
data = [
    ["Name", "1", "0.0"],
    ["", "", ""],
]

[[path]]
...

使用 KimariPlot 命令时可以更改绘图的参数,KimariPlot 支持的参数如下所示。

usage: kimariplot [--help] [--output_type OUTPUT] [--dpi DPI] [--font FONT] [--size SIZE] [--version] input_file

Generate a energy profile using kimariplot

positional arguments:
  input_file            Please input a Toml file

options:
  --help, -h            Show this help message and exit
  --output_type OUTPUT, -o OUTPUT
                        The output type of the graph
  --dpi DPI, -d DPI     The dpi of the output graph
  --font FONT, -f FONT  The font family of the graph
  --size SIZE, -s SIZE  The size of the graph
  --version, -v         show program's version number and exit

绘制效果

本例在 kimariplot 的 examples/profile1.toml 中

[[path]]
color = "black"
style = "-"
data = [
    ["7", "1", "-0.7"],
    ["TS1", "2", "22.4"],
    ["8", "3", "10.9"],
    ["TS2", "4", "18.0"],
    ["9", "5", "-8.7"],
    ["10", "6", "-10.0"]
]

[[path]]
color = "red"
style = "--"
data = [
    ["7", "1", "-0.7"],
    ["TS3", "2", "34.9"],
    ["11", "3", "17.2"],
    ["TS4", "4", "23.8"],
    ["10", "6", "-10.0"]
]

本例在 kimariplot 的 examples/profile2.toml 中

[[path]]
color = "black"
style = "-"
data = [
    ["R", "1", "0.0"],
    ["", "2", "-2.9"],
    ["", "3", "16.6"],
    ["CP2", "4", "-3.6"],
    ["P", "5", "-2.1"]
]

[[path]]
color = "red"
style = "--"
data = [
    ["R", "1", "0.0"],
    ["CP1", "2", "-4.4"],
    ["TS1", "3", "13.5"],
    ["", "4", "-1.5"],
    ["P", "5", "-2.1"]
]

[[path]]
color = "blue"
style = "--"
data = [
    ["", "1", "0.0"],
    ["", "2", "1.2"],
    ["", "3", "18.1"],
    ["", "4", "1.3"],
    ["", "5", "-2.1"]
]

[[path]]
color = "green"
style = "--"
data = [
    ["", "1", "0.0"],
    ["", "2", "2.3"],
    ["", "3", "19.8"],
    ["", "4", "2.5"],
    ["", "5", "-2.1"]
]

小技巧:如果发现两个坐标的标签重叠了,影响观看,可以将 data 属性中的第二个值错开。例如 example/profile3.toml:

[[path]]
color = "black"
style = "-"
data = [
    ["R", "1", "0.0"],
    ["CP1", "3", "-4.6"],
    ["TSa", "4", "-3.4"],
    ["CP2", "6", "-8.7"],
    ["P", "7", "-5.8"],
]


[[path]]
color = "blue"
style = "--"
data = [
    ["R", "1", "0.0"],
    ["CP0", "2", "-3.9"],
    ["TS0", "3", "4.1"],
    ["CP2a", "4", "-11.8"],
    ["P", "7", "-9.4"],
]

[[path]]
color = "red"
style = "--"
data = [
    ["R", "1", "0.0"],
    ["CP1s", "3", "-3.3"],
    ["TSs", "4", "-0.88"],
    ["CP2s", "5", "-9.1"],
    ["P", "7", "-5.8"],
]

鸣谢

KimariPlot 的开发离不开以下开源项目:

  • NumPy
  • Matplotlib
  • SciPy
  • Toml

还要感谢所有为 KimariPlot 做出贡献的开发者 Kimariyb 和用户。

许可证

KimariPlot 基于 MIT 许可证开源。这意味着您可以自由地使用、修改和分发代码。有关更多信息,请参见 LICENSE 文件。

Metadata

Release files for kimariplot 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kimariplot 1.3.2
File Size Uploaded
kimariplot-1.3.2.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kimariplot 1.3.2
File Interpreter ABI Platform
kimariplot-1.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.8 kB

Release files / kimariplot-1.3.2.tar.gz

Download URL kimariplot-1.3.2.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7cf33852fc2a1127737450262dc62b50fb0e2f5606cba78afba7de9c437508b0
BLAKE2b-256 checksum
How to use checksums
cfd8ac82cefb46b463cc8cf2b89cd358cc22ad57d298f7e95a84329455220bdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.13

Release files / kimariplot-1.3.2-py3-none-any.whl

Download URL kimariplot-1.3.2-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3c167d493e9e6c7ddf94d4a0452dea20b9f66c2f5d285158937921cec20d631
BLAKE2b-256 checksum
How to use checksums
98df568208b30dbfe5a7cbb79b8d886b88d85133b2c6370100b3e8a250963eed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.13

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page