like-sci-figures 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,31 +1,134 @@
|
|
|
1
1
|
# like-sci-figures
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **出版级学术图表生成器**(Publication-quality academic figure generator)
|
|
4
|
+
> 40 种图表类型 · 11 种期刊风格 · 34 套科研配色 · 中文自动检测 · 300DPI 输出 · 纯本地运行
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
从 JSON/CSV 数据一行命令生成出版级学术图表。基于 [scienceplots](https://github.com/garrettj403/SciencePlots) + [matplotlib](https://matplotlib.org/)。无 GUI、无云端,**数据不出本机**。适用于 SCI 论文、学位论文、期刊投稿、会议海报、科研报告及环境监测数据可视化配图。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 中文说明
|
|
11
|
+
|
|
12
|
+
### 安装
|
|
6
13
|
|
|
7
14
|
```bash
|
|
8
|
-
# 安装
|
|
9
15
|
npm install -g like-sci-figures
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 快速开始
|
|
10
19
|
|
|
20
|
+
```bash
|
|
11
21
|
# 生成图表
|
|
12
22
|
like-sci-figures --type bar --data data.json --out figure.png --style nature
|
|
13
23
|
```
|
|
14
24
|
|
|
25
|
+
### 环境要求
|
|
26
|
+
|
|
27
|
+
- **Python 3.9+**(需在 PATH 中,或用 `LIKE_SCI_PYTHON` 指定路径)
|
|
28
|
+
- Python 依赖:`matplotlib`、`numpy`、`scipy`、`pillow`
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
python -m pip install -r requirements.txt
|
|
32
|
+
# 可选:启用 LaTeX 级期刊风格(内置等效样式会自动后备,不影响基础出图)
|
|
33
|
+
pip install scienceplots
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 特性
|
|
37
|
+
|
|
38
|
+
- **40 种图表类型**:柱状图、分组柱状图、堆叠柱状图、热力图、散点图、折线图、箱线图、小提琴图、森林图、直方图、密度图、饼图、环形图、雷达图、3D 曲面、等高线图、3D 散点、气泡图、面积图/堆叠面积、误差棒图、韦恩图、PCA 双标图、风玫瑰图、Taylor 图、桑基图、多面板子图、火山图、曼哈顿图、Kaplan-Meier、ROC、脊线图、三元图、点图、树状图、斜率图、瀑布图、Bode 图、周期图、相关矩阵、六边形密度图、经验累积分布(ECDF)、Bland-Altman 一致性分析
|
|
39
|
+
- **11 种期刊风格**:Nature、Science、IEEE、Springer、Lancet、ACS、APS、AAAS、Cell、NEJM、MDPI
|
|
40
|
+
- **34 套科研配色**:定性 / 顺序 / 发散色带,通过 `--palette` 选择,或传入自定义十六进制列表
|
|
41
|
+
- **中文自动检测**:需要时自动加载中 / 日 / 韩字体,中文标签不出豆腐块
|
|
42
|
+
- **输出格式**:PNG / SVG / PDF,默认 300 DPI(可用 `--dpi` 调整)
|
|
43
|
+
|
|
44
|
+
### CLI 用法
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
like-sci-figures --type <图表> --data <file.json|csv> --out <output.png|svg|pdf> [选项]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| 选项 | 说明 |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `--type, -t` | 图表类型(必填),见下方列表 |
|
|
53
|
+
| `--data, -d` | 输入数据文件(JSON 或 CSV) |
|
|
54
|
+
| `--out, -o` | 输出路径(`.png` / `.svg` / `.pdf`) |
|
|
55
|
+
| `--title` | 图标题(用 `\n` 换行) |
|
|
56
|
+
| `--xlabel` / `--ylabel` | X / Y 轴标签 |
|
|
57
|
+
| `--style, -s` | 期刊风格(默认 `nature`) |
|
|
58
|
+
| `--palette, -p` | 配色 slug 或自定义十六进制列表 |
|
|
59
|
+
| `--dpi` | 输出分辨率(默认 300) |
|
|
60
|
+
| `--list-styles` | 列出可用期刊风格并退出 |
|
|
61
|
+
| `--list-palettes` | 列出可用配色并退出 |
|
|
62
|
+
| `--verify-all` | 运行引擎完整自检 |
|
|
63
|
+
|
|
64
|
+
### 图表类型
|
|
65
|
+
|
|
66
|
+
`bar` `grouped bar` `stacked bar` `heatmap` `scatter` `line` `box` `violin` `forest` `histogram` `density` `pie` `donut` `radar` `surface` `contour` `scatter3d` `bubble` `area` `errorbar` `venn` `pca` `windrose` `taylor` `sankey` `subplots` `volcano` `manhattan` `kaplan_meier` `roc` `ridge` `ternary` `dotplot` `dendrogram` `slope` `waterfall` `bode` `periodogram` `corr_matrix` `hexbin` `ecdf` `bland_altman`
|
|
67
|
+
|
|
68
|
+
### 示例
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Nature 风格柱状图,标注数值
|
|
72
|
+
like-sci-figures --type bar --data data.json --out figure.png --style nature --show-values
|
|
73
|
+
|
|
74
|
+
# 相关矩阵热力图(发散配色)
|
|
75
|
+
like-sci-figures --type corr_matrix --data corr.json --out corr.png --palette wx06_amber_navy
|
|
76
|
+
|
|
77
|
+
# 六边形密度图,自动加 1:1 线与 r/RMSE 角标
|
|
78
|
+
like-sci-figures --type hexbin --data obs.json --out hex.png --style cell --palette viridis
|
|
79
|
+
|
|
80
|
+
# 多面板子图
|
|
81
|
+
like-sci-figures --type subplots --data panel.json --out grid.png --layout 2x3 --style ieee
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 数据格式
|
|
85
|
+
|
|
86
|
+
JSON/CSV,schema 随图表类型自适应。柱状图示例:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"categories": ["PM2.5", "PM10", "SO2", "NO2"],
|
|
91
|
+
"values": [38.2, 61.4, 9.1, 24.6],
|
|
92
|
+
"errors": [3.1, 4.2, 0.8, 2.0]
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 环境变量
|
|
97
|
+
|
|
98
|
+
- `LIKE_SCI_PYTHON` — 指定 Python 解释器路径(默认使用 PATH 上的 `python` / `python3`)
|
|
99
|
+
|
|
100
|
+
### 许可证
|
|
101
|
+
|
|
102
|
+
Source-Available License(见 `LICENSE`)。允许个人与学术非商业使用;禁止商业性再分发与竞品产品化;保留上游 MIT 归属。
|
|
103
|
+
|
|
15
104
|
---
|
|
16
105
|
|
|
17
|
-
##
|
|
106
|
+
## English
|
|
107
|
+
|
|
108
|
+
### Installation
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npm install -g like-sci-figures
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Quick start
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
like-sci-figures --type bar --data data.json --out figure.png --style nature
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Requirements
|
|
18
121
|
|
|
19
|
-
- **Python 3.9+** (
|
|
122
|
+
- **Python 3.9+** (on PATH, or set `LIKE_SCI_PYTHON`)
|
|
20
123
|
- Python dependencies: `matplotlib`, `numpy`, `scipy`, `pillow`
|
|
21
124
|
|
|
22
125
|
```bash
|
|
23
126
|
python -m pip install -r requirements.txt
|
|
24
|
-
#
|
|
127
|
+
# Optional: enable LaTeX-grade journal styles (built-in equivalent styles fall back automatically)
|
|
25
128
|
pip install scienceplots
|
|
26
129
|
```
|
|
27
130
|
|
|
28
|
-
|
|
131
|
+
### Features
|
|
29
132
|
|
|
30
133
|
- **40 chart types**: bar, grouped bar, stacked bar, heatmap, scatter, line, box, violin, forest, histogram, density, pie, donut, radar, 3D surface, contour, 3D scatter, bubble, area/stacked-area, error-bar, Venn, PCA biplot, wind rose, Taylor diagram, Sankey, multi-panel subplots, volcano, Manhattan, Kaplan-Meier, ROC, ridge, ternary, dot plot, dendrogram, slope, waterfall, Bode, periodogram, correlation matrix, hexbin density, ECDF, Bland-Altman
|
|
31
134
|
- **11 journal styles**: Nature, Science, IEEE, Springer, Lancet, ACS, APS, AAAS, Cell, NEJM, MDPI
|
|
@@ -33,7 +136,7 @@ pip install scienceplots
|
|
|
33
136
|
- **CJK auto-detection**: automatically loads Chinese/Japanese/Korean fonts when needed
|
|
34
137
|
- **Output**: PNG / SVG / PDF at 300 DPI (adjustable via `--dpi`)
|
|
35
138
|
|
|
36
|
-
|
|
139
|
+
### CLI Usage
|
|
37
140
|
|
|
38
141
|
```bash
|
|
39
142
|
like-sci-figures --type <chart> --data <file.json|csv> --out <output.png|svg|pdf> [options]
|
|
@@ -73,7 +176,7 @@ like-sci-figures --type hexbin --data obs.json --out hex.png --style cell --pale
|
|
|
73
176
|
like-sci-figures --type subplots --data panel.json --out grid.png --layout 2x3 --style ieee
|
|
74
177
|
```
|
|
75
178
|
|
|
76
|
-
|
|
179
|
+
### Data Format
|
|
77
180
|
|
|
78
181
|
JSON/CSV with a flexible schema that adapts to each chart type. Example for a bar chart:
|
|
79
182
|
|
|
@@ -85,10 +188,10 @@ JSON/CSV with a flexible schema that adapts to each chart type. Example for a ba
|
|
|
85
188
|
}
|
|
86
189
|
```
|
|
87
190
|
|
|
88
|
-
|
|
191
|
+
### Environment
|
|
89
192
|
|
|
90
193
|
- `LIKE_SCI_PYTHON` — path to a specific Python interpreter (default: `python` / `python3` on PATH)
|
|
91
194
|
|
|
92
|
-
|
|
195
|
+
### License
|
|
93
196
|
|
|
94
197
|
Source-Available License (see `LICENSE`). Personal and academic use permitted; commercial redistribution and competing productization prohibited. Upstream MIT attribution preserved.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "like-sci-figures",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Publication-quality academic figure generator from JSON/CSV. scienceplots + matplotlib, 40 chart types, 11 journal styles, 34 curated palettes, CJK auto-detect, 300DPI PNG/SVG/PDF. Fully local, data never leaves your machine.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"like-sci-figures": "cli.js"
|