plotext-financial-chart by terrylica/cc-skills
npx skills add https://github.com/terrylica/cc-skills --skill plotext-financial-chart使用 plotext 的点标记 (•) 为 GitHub Flavored Markdown 创建 ASCII 金融折线图。纯文本输出 —— 可在 GitHub、终端和所有等宽环境中正确渲染。
类比 : graph-easy 用于流程图。带点标记的 plotext 用于金融折线图。
不适用于 : 流程图或架构图 —— 请使用 graph-easy。
/usr/bin/env bash << 'PREFLIGHT_EOF'
python3 --version &>/dev/null || { echo "ERROR: Python 3 not found"; exit 1; }
if command -v uv &>/dev/null; then PM="uv pip"
elif command -v pip3 &>/dev/null; then PM="pip3"
else echo "ERROR: Neither uv nor pip3 found"; exit 1; fi
python3 -c "import plotext" 2>/dev/null || { echo "Installing plotext via $PM..."; $PM install plotext; }
python3 -c "
import plotext as plt, re
plt.clear_figure()
plt.plot([1,2,3], [1,2,3], marker='dot')
plt.plotsize(20, 5)
plt.theme('clear')
output = re.sub(r'\x1b\[[0-9;]*m', '', plt.build())
assert '•' in output
" && echo "✓ plotext ready (dot marker verified)"
PREFLIGHT_EOF
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
import re
import plotext as plt
x = list(range(20))
y = [97, 98, 100, 101, 100, 98, 100, 101, 102, 101,
100, 98, 100, 101, 102, 103, 102, 101, 100, 100]
plt.clear_figure()
plt.plot(x, y, marker="dot", label="Price path")
plt.hline(103) # Upper barrier
plt.hline(97) # Lower barrier
plt.hline(100) # Entry price
plt.title("Triple Barrier Method")
plt.xlabel("Time (bars)")
plt.ylabel("Price")
plt.plotsize(65, 22)
plt.theme("clear")
print(re.sub(r'\x1b\[[0-9;]*m', '', plt.build()))
每个图表必须使用以下设置:
| 设置项 | 代码 | 原因 |
|---|---|---|
| 重置状态 | plt.clear_figure() | 防止残留数据 |
| 点标记 | marker="dot" | GitHub 安全对齐 |
| 无颜色 | plt.theme("clear") | 干净的文本输出 |
| 去除 ANSI | re.sub(r'\x1b\[…', '', …) | 移除残留转义码 |
| 构建为字符串 | plt.build() | 而非 plt.show() |
| 标记 | GitHub 安全 | 使用场景 |
|---|---|---|
"dot" | 是 | 默认 —— 始终使用 |
"hd" | 是 | 仅限终端,需要平滑度时 |
"braille" | 否 | 绝不用于 Markdown |
"fhd" | 否 | 绝不 —— 仅限 Unicode 13.0+ |
/usr/bin/env bash << 'RENDER_EOF'
python3 << 'CHART_EOF'
import re
import plotext as plt
x = list(range(20))
y = [97, 98, 100, 101, 100, 98, 100, 101, 102, 101,
100, 98, 100, 101, 102, 103, 102, 101, 100, 100]
plt.clear_figure()
plt.plot(x, y, marker="dot", label="Price path")
plt.hline(103)
plt.hline(97)
plt.hline(100)
plt.title("Triple Barrier Method")
plt.xlabel("Time (bars)")
plt.ylabel("Price")
plt.plotsize(65, 22)
plt.theme("clear")
print(re.sub(r'\x1b\[[0-9;]*m', '', plt.build()))
CHART_EOF
RENDER_EOF
每个图表必须紧跟着一个包含 Python 源代码的 <details> 块。解释性文本应放在 <details> 块之后,绝不能在图表和源代码之间。
✅ 正确:图表 → <details> → 解释性文本
❌ 错误:图表 → 解释性文本 → <details>
完整嵌入模板请参见 ./references/api-and-patterns.md。
plt.clear_figure() — 重置状态marker="dot" — 用于 GitHub 的点标记plt.theme("clear") + re.sub() 去除 — 无 ANSI 代码plt.title("...") — 每个图表都需要标题plt.xlabel / plt.ylabel — 坐标轴标签plt.plotsize(65, 22) — 适应 80 列代码块<details> 块紧接在图表之后(在任何解释性文本之前)| 问题 | 原因 | 解决方案 |
|---|---|---|
| 输出中包含 ANSI 代码 | 缺少主题/去除步骤 | 添加 plt.theme("clear") 和 re.sub() 去除 |
| 在 GitHub 上错位 | 标记类型错误 | 使用 marker="dot",绝不要用 braille/fhd |
| 图表太宽 | plotsize 太大 | 对于 80 列代码块,使用 plt.plotsize(65, 22) |
| 没有对角线斜率 | 数据点太少 | 使用 15+ 个数据点以获得可见的斜率 |
ModuleNotFoundError | 未安装 | 运行预检检查 |
| 输出为空 | 缺少 build() | 使用 plt.build() 而非 plt.show() |
每周安装次数
69
代码仓库
GitHub 星标数
26
首次出现
2026年2月7日
安全审计
已安装于
opencode67
kimi-cli66
amp66
github-copilot66
codex66
gemini-cli66
Create ASCII financial line charts for GitHub Flavored Markdown using plotext with dot marker (•). Pure text output — renders correctly on GitHub, terminals, and all monospace environments.
Analogy : graph-easy is for flowcharts. plotext with dot marker is for financial line charts.
NOT for : Flowcharts or architecture diagrams — use graph-easy for those.
/usr/bin/env bash << 'PREFLIGHT_EOF'
python3 --version &>/dev/null || { echo "ERROR: Python 3 not found"; exit 1; }
if command -v uv &>/dev/null; then PM="uv pip"
elif command -v pip3 &>/dev/null; then PM="pip3"
else echo "ERROR: Neither uv nor pip3 found"; exit 1; fi
python3 -c "import plotext" 2>/dev/null || { echo "Installing plotext via $PM..."; $PM install plotext; }
python3 -c "
import plotext as plt, re
plt.clear_figure()
plt.plot([1,2,3], [1,2,3], marker='dot')
plt.plotsize(20, 5)
plt.theme('clear')
output = re.sub(r'\x1b\[[0-9;]*m', '', plt.build())
assert '•' in output
" && echo "✓ plotext ready (dot marker verified)"
PREFLIGHT_EOF
import re
import plotext as plt
x = list(range(20))
y = [97, 98, 100, 101, 100, 98, 100, 101, 102, 101,
100, 98, 100, 101, 102, 103, 102, 101, 100, 100]
plt.clear_figure()
plt.plot(x, y, marker="dot", label="Price path")
plt.hline(103) # Upper barrier
plt.hline(97) # Lower barrier
plt.hline(100) # Entry price
plt.title("Triple Barrier Method")
plt.xlabel("Time (bars)")
plt.ylabel("Price")
plt.plotsize(65, 22)
plt.theme("clear")
print(re.sub(r'\x1b\[[0-9;]*m', '', plt.build()))
Every chart MUST use these settings:
| Setting | Code | Why |
|---|---|---|
| Reset state | plt.clear_figure() | Prevent stale data |
| Dot marker | marker="dot" | GitHub-safe alignment |
| No color | plt.theme("clear") | Clean text output |
| Strip ANSI | re.sub(r'\x1b\[…', '', …) | Remove residual escape codes |
| Build as string | plt.build() |
| Marker | GitHub Safe | Use When |
|---|---|---|
"dot" | Yes | Default — always use |
"hd" | Yes | Terminal-only, need smoothness |
"braille" | No | Never for markdown |
"fhd" | No | Never — Unicode 13.0+ only |
/usr/bin/env bash << 'RENDER_EOF'
python3 << 'CHART_EOF'
import re
import plotext as plt
x = list(range(20))
y = [97, 98, 100, 101, 100, 98, 100, 101, 102, 101,
100, 98, 100, 101, 102, 103, 102, 101, 100, 100]
plt.clear_figure()
plt.plot(x, y, marker="dot", label="Price path")
plt.hline(103)
plt.hline(97)
plt.hline(100)
plt.title("Triple Barrier Method")
plt.xlabel("Time (bars)")
plt.ylabel("Price")
plt.plotsize(65, 22)
plt.theme("clear")
print(re.sub(r'\x1b\[[0-9;]*m', '', plt.build()))
CHART_EOF
RENDER_EOF
Every chart MUST be immediately followed by a <details> block with Python source. Explanatory text goes after the <details> block, never between chart and source.
✅ CORRECT: Chart → <details> → Explanatory text
❌ WRONG: Chart → Explanatory text → <details>
See ./references/api-and-patterns.md for full embedding template.
plt.clear_figure() — Reset statemarker="dot" — Dot marker for GitHubplt.theme("clear") + re.sub() strip — No ANSI codesplt.title("...") — Every chart needs a titleplt.xlabel / plt.ylabel — Axis labelsplt.plotsize(65, 22) — Fits 80-col code blocks<details> block immediately after chart (before any explanatory text)| Issue | Cause | Solution |
|---|---|---|
| ANSI codes in output | Missing theme/strip | Add plt.theme("clear") and re.sub() strip |
| Misaligned on GitHub | Wrong marker type | Use marker="dot", never braille/fhd |
| Chart too wide | plotsize too large | Use plt.plotsize(65, 22) for 80-col blocks |
| No diagonal slopes | Too few data points | Use 15+ data points for visible slopes |
ModuleNotFoundError |
Weekly Installs
69
Repository
GitHub Stars
26
First Seen
Feb 7, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode67
kimi-cli66
amp66
github-copilot66
codex66
gemini-cli66
Lark Skill Maker 教程:基于飞书CLI创建AI技能,自动化工作流与API调用指南
39,100 周安装
screenshot 截图技能:跨平台桌面截图工具,支持macOS/Linux权限管理与多模式捕获
69 周安装
tmux进程管理最佳实践:交互式Shell初始化、会话命名与生命周期管理
69 周安装
Git Rebase Sync:安全同步分支的Git变基工具,解决冲突与备份
69 周安装
LinkedIn自动化工具 - Claude Code专属,自然对话拓展人脉,避免垃圾信息
69 周安装
实验流水线框架:4阶段科研实验执行与消融研究方法论 | EvoScientist
69 周安装
Salesforce B2C SLAS高级认证模式指南:无密码登录、混合店面与系统集成
81 周安装
Not plt.show() |
| Not installed |
| Run preflight check |
| Empty output | Missing build() | Use plt.build() not plt.show() |