Generate diagrams and flowcharts using Graphviz (Python). Supports flowcharts, architecture diagrams, state diagrams, and data flow diagrams.
Graphviz-based diagram generation skill using Python.
✅ Already installed:
/usr/bin/dot)/tmp/chart-venv/source /tmp/chart-venv/bin/activate
from graphviz import Digraph
# Create flowchart
dot = Digraph()
dot.attr(rankdir='TB')
# Add nodes
dot.node('A', 'Start', shape='ellipse', style='filled', fillcolor='lightblue')
dot.node('B', 'Decision', shape='diamond', style='filled', fillcolor='lightyellow')
dot.node('C', 'Execute', shape='box', style='filled', fillcolor='lightgreen')
dot.node('D', 'End', shape='ellipse', style='filled', fillcolor='lightcoral')
# Add edges
dot.edge('A', 'B')
dot.edge('B', 'C', label='Yes')
dot.edge('B', 'D', label='No')
dot.edge('C', 'D')
# Save as PNG
dot.render('/tmp/flowchart', format='png', cleanup=True)
print("✅ Flowchart generated")
box - Rectangle (normal steps)diamond - Diamond (decisions)ellipse - Ellipse (start/end)circle - Circle (initial state)cylinder - Cylinder (database)See GRAPHVIZ-USAGE.md for detailed examples:
source /tmp/chart-venv/bin/activate
python3 << 'EOF'
from graphviz import Digraph
dot = Digraph()
dot.node('A', '测试节点')
dot.render('/tmp/test', format='png', cleanup=True)
print("✅ 测试图表已生成")
EOF
ls -lh /tmp/test.png
MIT License
Copyright (c) 2026 思捷娅科技 (SJYKJ)
免费使用、修改和重新分发时,需注明出处。
出处:
商业使用授权: