太阳系比例海报:把太阳和八大行星按真实比例画成圆,同时换算“如果按同一比例摆放,需要多长的纸”。
- 内置太阳与八大行星的半径、日距与配色
- 任意比例尺
--km-per-mm,也可用--fit让某个天体刚好填满页面宽度 - SVG 严格按比例绘制,A4 直接打印
- 距离表同时给出千米、AU、图上尺寸与所需纸张长度
- 纯标准库,零依赖,跨平台
python -m pip install -e .solarscale poster --km-per-mm 8000 -o poster.html
solarscale poster --fit Sun --width 180 -o sun.html
solarscale table --km-per-mm 8000
solarscale table --html > table.html
solarscale info Earth| 命令 | 说明 |
|---|---|
poster |
生成 A4 海报 HTML |
table |
打印比例表,--html 输出网页表格 |
info |
查看单个天体的直径、日距与图上尺寸 |
| 天体 | 直径(千米) | 日距(AU) |
|---|---|---|
| 太阳 | 1,392,680 | 0 |
| 水星 | 4,879.4 | 0.387 |
| 金星 | 12,103.6 | 0.723 |
| 地球 | 12,742 | 1.000 |
| 火星 | 6,779 | 1.524 |
| 木星 | 139,822 | 5.203 |
| 土星 | 116,464 | 9.537 |
| 天王星 | 50,724 | 19.191 |
| 海王星 | 49,244 | 30.069 |
按 1 毫米 = 8000 千米计算,太阳能装进 A4 纸,而海王星要放到 560 米开外——这正是海报想传达的尺度感。
examples/solarscale.html 是默认比例(1 毫米 = 8000 千米)的 A4 海报。
python -m unittest discover -s tests -v
MIT © 2026 eastyou