data-visualization
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseData Visualization
数据可视化
Create clear, effective data visualizations via inference.sh CLI.
通过inference.sh CLI创建清晰、有效的数据可视化内容。
Quick Start
快速开始
bash
curl -fsSL https://cli.inference.sh | sh && infsh loginbash
curl -fsSL https://cli.inference.sh | sh && infsh loginGenerate a chart with Python
Generate a chart with Python
infsh app run infsh/python-executor --input '{
"code": "import matplotlib.pyplot as plt\nimport matplotlib\nmatplotlib.use("Agg")\n\nmonths = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]\nrevenue = [42, 48, 55, 61, 72, 89]\n\nfig, ax = plt.subplots(figsize=(10, 6))\nax.bar(months, revenue, color="#3b82f6", width=0.6)\nax.set_ylabel("Revenue ($K)")\nax.set_title("Monthly Revenue Growth", fontweight="bold")\nfor i, v in enumerate(revenue):\n ax.text(i, v + 1, f"${v}K", ha="center", fontweight="bold")\nplt.tight_layout()\nplt.savefig("revenue.png", dpi=150)\nprint("Saved")"
}'
undefinedinfsh app run infsh/python-executor --input '{
"code": "import matplotlib.pyplot as plt\nimport matplotlib\nmatplotlib.use("Agg")\n\nmonths = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]\nrevenue = [42, 48, 55, 61, 72, 89]\n\nfig, ax = plt.subplots(figsize=(10, 6))\nax.bar(months, revenue, color="#3b82f6", width=0.6)\nax.set_ylabel("Revenue ($K)")\nax.set_title("Monthly Revenue Growth", fontweight="bold")\nfor i, v in enumerate(revenue):\n ax.text(i, v + 1, f"${v}K", ha="center", fontweight="bold")\nplt.tight_layout()\nplt.savefig("revenue.png", dpi=150)\nprint("Saved")"
}'
undefinedChart Selection Guide
图表选择指南
Which Chart for Which Data?
不同数据对应哪种图表?
| Data Relationship | Best Chart | Never Use |
|---|---|---|
| Change over time | Line chart | Pie chart |
| Comparing categories | Bar chart (horizontal for many categories) | Line chart |
| Part of a whole | Stacked bar, treemap | Pie chart (controversial but: bar is always clearer) |
| Distribution | Histogram, box plot | Bar chart |
| Correlation | Scatter plot | Bar chart |
| Ranking | Horizontal bar chart | Vertical bar, pie |
| Geographic | Choropleth map | Bar chart |
| Composition over time | Stacked area chart | Multiple pie charts |
| Single metric | Big number (KPI card) | Any chart (overkill) |
| Flow / process | Sankey diagram | Bar chart |
| 数据关系 | 最佳图表 | 避免使用 |
|---|---|---|
| 随时间变化 | 折线图 | 饼图 |
| 类别对比 | 柱状图(类别较多时用横向) | 折线图 |
| 整体占比 | 堆叠柱状图、树形图 | 饼图(虽有争议,但柱状图始终更清晰) |
| 分布情况 | 直方图、箱线图 | 柱状图 |
| 相关性 | 散点图 | 柱状图 |
| 排名排序 | 横向柱状图 | 纵向柱状图、饼图 |
| 地理数据 | 分级统计图 | 柱状图 |
| 随时间的构成变化 | 堆叠面积图 | 多饼图 |
| 单一指标 | 大数字(KPI卡片) | 任何图表(小题大做) |
| 流程/流向 | 桑基图 | 柱状图 |
The Pie Chart Problem
饼图的问题
Pie charts are almost always the wrong choice:
❌ Pie chart problems:
- Hard to compare similar-sized slices
- Can't show more than 5-6 categories
- 3D pie charts are always wrong
- Impossible to read exact values
✅ Use instead:
- Horizontal bar chart (easy comparison)
- Stacked bar (part of whole)
- Treemap (hierarchical parts)
- Just a table (if precision matters)饼图几乎总是错误的选择:
❌ 饼图的问题:
- 难以对比相似大小的扇区
- 无法展示超过5-6个类别
- 3D饼图绝对不可用
- 无法读取精确数值
✅ 替代方案:
- 横向柱状图(便于对比)
- 堆叠柱状图(展示占比)
- 树形图(层级占比)
- 直接用表格(如果需要精确值)Design Rules
设计规则
Axes
坐标轴
| Rule | Why |
|---|---|
| Always start Y-axis at 0 (bar charts) | Prevents misleading visual |
| Line charts CAN start above 0 | When showing change, not absolute values |
| Label both axes | Reader shouldn't have to guess units |
| Remove unnecessary gridlines | Reduce visual noise |
| Use horizontal labels | Vertical text is hard to read |
| Sort bar charts by value | Don't use alphabetical order unless there's a reason |
| 规则 | 原因 |
|---|---|
| 柱状图Y轴始终从0开始 | 避免视觉误导 |
| 折线图可以从0以上开始 | 当展示变化而非绝对值时 |
| 为两个坐标轴添加标签 | 读者无需猜测单位 |
| 移除不必要的网格线 | 减少视觉干扰 |
| 使用横向标签 | 垂直文本难以阅读 |
| 柱状图按数值排序 | 除非有特殊原因,否则不要按字母顺序 |
Color
色彩
| Principle | Application |
|---|---|
| Max 5-7 colors per chart | More becomes unreadable |
| Highlight one thing | Grey everything else, color the focus |
| Sequential for magnitude | Light → dark for low → high |
| Diverging for positive/negative | Red ← neutral → blue |
| Categorical for groups | Distinct hues, similar brightness |
| Colorblind-safe | Avoid red/green only — add shapes or labels |
| Consistent meaning | If blue = revenue, keep it blue everywhere |
| 原则 | 应用 |
|---|---|
| 每张图表最多5-7种颜色 | 过多颜色会导致难以阅读 |
| 突出重点内容 | 其他内容设为灰色,仅高亮重点 |
| 连续色用于量级 | 浅→深代表低→高 |
| 发散色用于正负值 | 红←中性色→蓝 |
| 分类色用于分组 | 不同色调,亮度相近 |
| 色盲友好 | 避免仅用红/绿——添加形状或标签 |
| 颜色含义一致 | 如果蓝色代表收入,所有地方都用蓝色 |
Good Color Palettes
优质色彩调色板
python
undefinedpython
undefinedSequential (low to high)
Sequential (low to high)
sequential = ["#eff6ff", "#bfdbfe", "#60a5fa", "#2563eb", "#1d4ed8"]
sequential = ["#eff6ff", "#bfdbfe", "#60a5fa", "#2563eb", "#1d4ed8"]
Diverging (negative to positive)
Diverging (negative to positive)
diverging = ["#ef4444", "#f87171", "#d1d5db", "#34d399", "#10b981"]
diverging = ["#ef4444", "#f87171", "#d1d5db", "#34d399", "#10b981"]
Categorical (distinct groups)
Categorical (distinct groups)
categorical = ["#3b82f6", "#f59e0b", "#10b981", "#8b5cf6", "#ef4444"]
categorical = ["#3b82f6", "#f59e0b", "#10b981", "#8b5cf6", "#ef4444"]
Colorblind-safe
Colorblind-safe
cb_safe = ["#0077BB", "#33BBEE", "#009988", "#EE7733", "#CC3311"]
undefinedcb_safe = ["#0077BB", "#33BBEE", "#009988", "#EE7733", "#CC3311"]
undefinedText and Labels
文本与标签
| Element | Rule |
|---|---|
| Title | States the insight, not the data type. "Revenue doubled in Q2" not "Q2 Revenue Chart" |
| Annotations | Call out key data points directly on the chart |
| Legend | Avoid if possible — label directly on chart lines/bars |
| Font size | Minimum 12px, 14px+ for presentations |
| Number format | Use K, M, B for large numbers (42K not 42,000) |
| Data labels | Add to bars/points when exact values matter |
| 元素 | 规则 |
|---|---|
| 标题 | 阐述洞察,而非数据类型。例如“第二季度收入翻倍”而非“第二季度收入图表” |
| 注释 | 在图表上直接标注关键数据点 |
| 图例 | 尽可能避免——直接在图表线条/柱状上标注 |
| 字体大小 | 最小12px,演示文稿用14px以上 |
| 数字格式 | 大数字用K、M、B(如42K而非42,000) |
| 数据标签 | 当需要精确值时,添加到柱状/数据点上 |
Chart Recipes
图表示例
Line Chart (Time Series)
折线图(时间序列)
bash
infsh app run infsh/python-executor --input '{
"code": "import matplotlib.pyplot as plt\nimport matplotlib\nmatplotlib.use(\"Agg\")\n\nfig, ax = plt.subplots(figsize=(12, 6))\nfig.patch.set_facecolor(\"white\")\n\nmonths = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\nthis_year = [120, 135, 148, 162, 178, 195, 210, 228, 245, 268, 290, 320]\nlast_year = [95, 102, 108, 115, 122, 130, 138, 145, 155, 165, 178, 190]\n\nax.plot(months, this_year, color=\"#3b82f6\", linewidth=2.5, marker=\"o\", markersize=6, label=\"2024\")\nax.plot(months, last_year, color=\"#94a3b8\", linewidth=2, linestyle=\"--\", label=\"2023\")\nax.fill_between(range(len(months)), last_year, this_year, alpha=0.1, color=\"#3b82f6\")\n\nax.annotate(\"$320K\", xy=(11, 320), fontsize=14, fontweight=\"bold\", color=\"#3b82f6\")\nax.annotate(\"$190K\", xy=(11, 190), fontsize=12, color=\"#94a3b8\")\n\nax.set_ylabel(\"Revenue ($K)\", fontsize=12)\nax.set_title(\"Revenue grew 68% year-over-year\", fontsize=16, fontweight=\"bold\")\nax.legend(fontsize=12)\nax.spines[\"top\"].set_visible(False)\nax.spines[\"right\"].set_visible(False)\nax.grid(axis=\"y\", alpha=0.3)\nplt.tight_layout()\nplt.savefig(\"line-chart.png\", dpi=150)\nprint(\"Saved\")"
}'bash
infsh app run infsh/python-executor --input '{
"code": "import matplotlib.pyplot as plt\nimport matplotlib\nmatplotlib.use(\"Agg\")\n\nfig, ax = plt.subplots(figsize=(12, 6))\nfig.patch.set_facecolor(\"white\")\n\nmonths = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\nthis_year = [120, 135, 148, 162, 178, 195, 210, 228, 245, 268, 290, 320]\nlast_year = [95, 102, 108, 115, 122, 130, 138, 145, 155, 165, 178, 190]\n\nax.plot(months, this_year, color=\"#3b82f6\", linewidth=2.5, marker=\"o\", markersize=6, label=\"2024\")\nax.plot(months, last_year, color=\"#94a3b8\", linewidth=2, linestyle=\"--\", label=\"2023\")\nax.fill_between(range(len(months)), last_year, this_year, alpha=0.1, color=\"#3b82f6\")\n\nax.annotate(\"$320K\", xy=(11, 320), fontsize=14, fontweight=\"bold\", color=\"#3b82f6\")\nax.annotate(\"$190K\", xy=(11, 190), fontsize=12, color=\"#94a3b8\")\n\nax.set_ylabel(\"Revenue ($K)\", fontsize=12)\nax.set_title(\"Revenue grew 68% year-over-year\", fontsize=16, fontweight=\"bold\")\nax.legend(fontsize=12)\nax.spines[\"top\"].set_visible(False)\nax.spines[\"right\"].set_visible(False)\nax.grid(axis=\"y\", alpha=0.3)\nplt.tight_layout()\nplt.savefig(\"line-chart.png\", dpi=150)\nprint(\"Saved\")"
}'Horizontal Bar Chart (Comparison)
横向柱状图(对比)
bash
infsh app run infsh/python-executor --input '{
"code": "import matplotlib.pyplot as plt\nimport matplotlib\nmatplotlib.use(\"Agg\")\n\nfig, ax = plt.subplots(figsize=(10, 6))\n\ncategories = [\"Email\", \"Social\", \"SEO\", \"Paid Ads\", \"Referral\", \"Direct\"]\nvalues = [12, 18, 35, 22, 8, 5]\ncolors = [\"#94a3b8\"] * len(values)\ncolors[2] = \"#3b82f6\" # Highlight the winner\n\n# Sort by value\nsorted_pairs = sorted(zip(values, categories, colors))\nvalues, categories, colors = zip(*sorted_pairs)\n\nax.barh(categories, values, color=colors, height=0.6)\nfor i, v in enumerate(values):\n ax.text(v + 0.5, i, f\"{v}%\", va=\"center\", fontsize=12, fontweight=\"bold\")\n\nax.set_xlabel(\"% of Total Traffic\", fontsize=12)\nax.set_title(\"SEO drives the most traffic\", fontsize=16, fontweight=\"bold\")\nax.spines[\"top\"].set_visible(False)\nax.spines[\"right\"].set_visible(False)\nplt.tight_layout()\nplt.savefig(\"bar-chart.png\", dpi=150)\nprint(\"Saved\")"
}'bash
infsh app run infsh/python-executor --input '{
"code": "import matplotlib.pyplot as plt\nimport matplotlib\nmatplotlib.use(\"Agg\")\n\nfig, ax = plt.subplots(figsize=(10, 6))\n\ncategories = [\"Email\", \"Social\", \"SEO\", \"Paid Ads\", \"Referral\", \"Direct\"]\nvalues = [12, 18, 35, 22, 8, 5]\ncolors = [\"#94a3b8\"] * len(values)\ncolors[2] = \"#3b82f6\" # Highlight the winner\n\n# Sort by value\nsorted_pairs = sorted(zip(values, categories, colors))\nvalues, categories, colors = zip(*sorted_pairs)\n\nax.barh(categories, values, color=colors, height=0.6)\nfor i, v in enumerate(values):\n ax.text(v + 0.5, i, f\"{v}%\", va=\"center\", fontsize=12, fontweight=\"bold\")\n\nax.set_xlabel(\"% of Total Traffic\", fontsize=12)\nax.set_title(\"SEO drives the most traffic\", fontsize=16, fontweight=\"bold\")\nax.spines[\"top\"].set_visible(False)\nax.spines[\"right\"].set_visible(False)\nplt.tight_layout()\nplt.savefig(\"bar-chart.png\", dpi=150)\nprint(\"Saved\")"
}'KPI / Big Number Card
KPI / 大数字卡片
bash
infsh app run infsh/html-to-image --input '{
"html": "<div style=\"display:flex;gap:20px;padding:20px;background:white;font-family:system-ui\"><div style=\"background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:24px;width:200px;text-align:center\"><p style=\"color:#64748b;font-size:14px;margin:0\">Monthly Revenue</p><p style=\"font-size:48px;font-weight:900;margin:8px 0;color:#1e293b\">$89K</p><p style=\"color:#22c55e;font-size:14px;margin:0\">↑ 23% vs last month</p></div><div style=\"background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:24px;width:200px;text-align:center\"><p style=\"color:#64748b;font-size:14px;margin:0\">Active Users</p><p style=\"font-size:48px;font-weight:900;margin:8px 0;color:#1e293b\">12.4K</p><p style=\"color:#22c55e;font-size:14px;margin:0\">↑ 8% vs last month</p></div><div style=\"background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:24px;width:200px;text-align:center\"><p style=\"color:#64748b;font-size:14px;margin:0\">Churn Rate</p><p style=\"font-size:48px;font-weight:900;margin:8px 0;color:#1e293b\">2.1%</p><p style=\"color:#ef4444;font-size:14px;margin:0\">↑ 0.3% vs last month</p></div></div>"
}'bash
infsh app run infsh/html-to-image --input '{
"html": "<div style=\"display:flex;gap:20px;padding:20px;background:white;font-family:system-ui\"><div style=\"background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:24px;width:200px;text-align:center\"><p style=\"color:#64748b;font-size:14px;margin:0\">Monthly Revenue</p><p style=\"font-size:48px;font-weight:900;margin:8px 0;color:#1e293b\">$89K</p><p style=\"color:#22c55e;font-size:14px;margin:0\">↑ 23% vs last month</p></div><div style=\"background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:24px;width:200px;text-align:center\"><p style=\"color:#64748b;font-size:14px;margin:0\">Active Users</p><p style=\"font-size:48px;font-weight:900;margin:8px 0;color:#1e293b\">12.4K</p><p style=\"color:#22c55e;font-size:14px;margin:0\">↑ 8% vs last month</p></div><div style=\"background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:24px;width:200px;text-align:center\"><p style=\"color:#64748b;font-size:14px;margin:0\">Churn Rate</p><p style=\"font-size:48px;font-weight:900;margin:8px 0;color:#1e293b\">2.1%</p><p style=\"color:#ef4444;font-size:14px;margin:0\">↑ 0.3% vs last month</p></div></div>"
}'Heatmap
热力图
bash
infsh app run infsh/python-executor --input '{
"code": "import matplotlib.pyplot as plt\nimport numpy as np\nimport matplotlib\nmatplotlib.use(\"Agg\")\n\nfig, ax = plt.subplots(figsize=(10, 6))\n\ndays = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"]\nhours = [\"9AM\", \"10AM\", \"11AM\", \"12PM\", \"1PM\", \"2PM\", \"3PM\", \"4PM\", \"5PM\"]\ndata = np.random.randint(10, 100, size=(len(hours), len(days)))\ndata[2][1] = 95 # Tuesday 11AM peak\ndata[2][3] = 88 # Thursday 11AM\n\nim = ax.imshow(data, cmap=\"Blues\", aspect=\"auto\")\nax.set_xticks(range(len(days)))\nax.set_yticks(range(len(hours)))\nax.set_xticklabels(days, fontsize=12)\nax.set_yticklabels(hours, fontsize=12)\n\nfor i in range(len(hours)):\n for j in range(len(days)):\n color = \"white\" if data[i][j] > 60 else \"black\"\n ax.text(j, i, data[i][j], ha=\"center\", va=\"center\", fontsize=10, color=color)\n\nax.set_title(\"Website Traffic by Day & Hour\", fontsize=16, fontweight=\"bold\")\nplt.colorbar(im, label=\"Visitors\")\nplt.tight_layout()\nplt.savefig(\"heatmap.png\", dpi=150)\nprint(\"Saved\")"
}'bash
infsh app run infsh/python-executor --input '{
"code": "import matplotlib.pyplot as plt\nimport numpy as np\nimport matplotlib\nmatplotlib.use(\"Agg\")\n\nfig, ax = plt.subplots(figsize=(10, 6))\n\ndays = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"]\nhours = [\"9AM\", \"10AM\", \"11AM\", \"12PM\", \"1PM\", \"2PM\", \"3PM\", \"4PM\", \"5PM\"]\ndata = np.random.randint(10, 100, size=(len(hours), len(days)))\ndata[2][1] = 95 # Tuesday 11AM peak\ndata[2][3] = 88 # Thursday 11AM\n\nim = ax.imshow(data, cmap=\"Blues\", aspect=\"auto\")\nax.set_xticks(range(len(days)))\nax.set_yticks(range(len(hours)))\nax.set_xticklabels(days, fontsize=12)\nax.set_yticklabels(hours, fontsize=12)\n\nfor i in range(len(hours)):\n for j in range(len(days)):\n color = \"white\" if data[i][j] > 60 else \"black\"\n ax.text(j, i, data[i][j], ha=\"center\", va=\"center\", fontsize=10, color=color)\n\nax.set_title(\"Website Traffic by Day & Hour\", fontsize=16, fontweight=\"bold\")\nplt.colorbar(im, label=\"Visitors\")\nplt.tight_layout()\nplt.savefig(\"heatmap.png\", dpi=150)\nprint(\"Saved\")"
}'Storytelling with Data
数据叙事
The Narrative Arc
叙事结构
| Step | What to Do | Example |
|---|---|---|
| 1. Context | Set up what the reader needs to know | "We track customer acquisition cost monthly" |
| 2. Tension | Show the problem or change | "CAC increased 40% in Q3" |
| 3. Resolution | Show the insight or solution | "But LTV increased 80%, so unit economics improved" |
| 步骤 | 操作 | 示例 |
|---|---|---|
| 1. 背景 | 说明读者需要了解的信息 | “我们每月跟踪客户获取成本” |
| 2. 冲突 | 展示问题或变化 | “第三季度CAC增长了40%” |
| 3. 解决 | 展示洞察或方案 | “但LTV增长了80%,所以单位经济效益提升了” |
Title as Insight
标题即洞察
❌ Descriptive titles (what the chart shows):
"Q3 Revenue by Product Line"
"Monthly Active Users 2024"
"Customer Satisfaction Survey Results"
✅ Insight titles (what the chart means):
"Enterprise product drives 70% of revenue growth"
"User growth accelerated after the free tier launch"
"Support response time is the #1 satisfaction driver"❌ 描述性标题(图表展示内容):
"第三季度各产品线收入"
"2024年月活跃用户"
"客户满意度调查结果"
✅ 洞察性标题(图表含义):
"企业产品带动70%的收入增长"
"免费套餐推出后用户增长加速"
"支持响应时间是满意度的首要驱动因素"Annotation Techniques
注释技巧
| Technique | When to Use |
|---|---|
| Call-out label | Highlight a specific data point ("Peak: 320K") |
| Reference line | Show target/benchmark ("Goal: 100K") |
| Shaded region | Mark a time period ("Product launch window") |
| Arrow + text | Draw attention to trend change |
| Before/after line | Show impact of an event |
| 技巧 | 使用场景 |
|---|---|
| 标注标签 | 高亮特定数据点(“峰值:320K”) |
| 参考线 | 展示目标/基准(“目标:100K”) |
| 阴影区域 | 标记时间段(“产品发布窗口”) |
| 箭头+文本 | 吸引注意力到趋势变化 |
| 前后对比线 | 展示事件的影响 |
Dark Mode Charts
深色模式图表
bash
infsh app run infsh/python-executor --input '{
"code": "import matplotlib.pyplot as plt\nimport matplotlib\nmatplotlib.use(\"Agg\")\n\n# Dark theme\nplt.rcParams.update({\n \"figure.facecolor\": \"#0f172a\",\n \"axes.facecolor\": \"#0f172a\",\n \"axes.edgecolor\": \"#334155\",\n \"axes.labelcolor\": \"white\",\n \"text.color\": \"white\",\n \"xtick.color\": \"white\",\n \"ytick.color\": \"white\",\n \"grid.color\": \"#1e293b\"\n})\n\nfig, ax = plt.subplots(figsize=(12, 6))\nmonths = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\"]\nvalues = [45, 52, 58, 72, 85, 98]\n\nax.plot(months, values, color=\"#818cf8\", linewidth=3, marker=\"o\", markersize=8)\nax.fill_between(range(len(months)), values, alpha=0.15, color=\"#818cf8\")\nax.set_title(\"MRR Growth: On track for $100K\", fontsize=18, fontweight=\"bold\")\nax.set_ylabel(\"MRR ($K)\", fontsize=13)\nax.spines[\"top\"].set_visible(False)\nax.spines[\"right\"].set_visible(False)\nax.grid(axis=\"y\", alpha=0.2)\n\nfor i, v in enumerate(values):\n ax.annotate(f\"${v}K\", (i, v), textcoords=\"offset points\", xytext=(0, 12), ha=\"center\", fontsize=11, fontweight=\"bold\")\n\nplt.tight_layout()\nplt.savefig(\"dark-chart.png\", dpi=150, facecolor=\"#0f172a\")\nprint(\"Saved\")"
}'bash
infsh app run infsh/python-executor --input '{
"code": "import matplotlib.pyplot as plt\nimport matplotlib\nmatplotlib.use(\"Agg\")\n\n# Dark theme\nplt.rcParams.update({\n \"figure.facecolor\": \"#0f172a\",\n \"axes.facecolor\": \"#0f172a\",\n \"axes.edgecolor\": \"#334155\",\n \"axes.labelcolor\": \"white\",\n \"text.color\": \"white\",\n \"xtick.color\": \"white\",\n \"ytick.color\": \"white\",\n \"grid.color\": \"#1e293b\"\n})\n\nfig, ax = plt.subplots(figsize=(12, 6))\nmonths = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\"]\nvalues = [45, 52, 58, 72, 85, 98]\n\nax.plot(months, values, color=\"#818cf8\", linewidth=3, marker=\"o\", markersize=8)\nax.fill_between(range(len(months)), values, alpha=0.15, color=\"#818cf8\")\nax.set_title(\"MRR Growth: On track for $100K\", fontsize=18, fontweight=\"bold\")\nax.set_ylabel(\"MRR ($K)\", fontsize=13)\nax.spines[\"top\"].set_visible(False)\nax.spines[\"right\"].set_visible(False)\nax.grid(axis=\"y\", alpha=0.2)\n\nfor i, v in enumerate(values):\n ax.annotate(f\"${v}K\", (i, v), textcoords=\"offset points\", xytext=(0, 12), ha=\"center\", fontsize=11, fontweight=\"bold\")\n\nplt.tight_layout()\nplt.savefig(\"dark-chart.png\", dpi=150, facecolor=\"#0f172a\")\nprint(\"Saved\")"
}'Common Mistakes
常见错误
| Mistake | Problem | Fix |
|---|---|---|
| Pie charts | Hard to compare, always misleading | Use bar charts or treemaps |
| Y-axis not starting at 0 (bar charts) | Exaggerates differences | Start at 0 for bars, OK to truncate for lines |
| Too many colors | Visual noise, confusing | Max 5-7 colors, highlight only what matters |
| No title or generic title | Reader doesn't know the insight | Title = the takeaway, not the data type |
| 3D charts | Distorts data, looks unprofessional | Always use 2D |
| Dual Y-axes | Misleading, hard to read | Use two separate charts |
| Alphabetical sort on bar charts | Hides the story | Sort by value (largest first) |
| No labels on axes | Reader can't interpret | Always label with units |
| Chartjunk (decorative elements) | Distracts from data | Remove everything that doesn't convey information |
| Red/green only for color coding | Colorblind users can't read | Use shapes, patterns, or colorblind-safe palettes |
| 错误 | 问题 | 修复方案 |
|---|---|---|
| 使用饼图 | 难以对比,具有误导性 | 使用柱状图或树形图 |
| 柱状图Y轴不从0开始 | 夸大差异 | 柱状图从0开始,折线图可以截断 |
| 颜色过多 | 视觉干扰,令人困惑 | 最多5-7种颜色,仅高亮重点 |
| 无标题或通用标题 | 读者无法获取洞察 | 标题即核心结论,而非数据类型 |
| 3D图表 | 扭曲数据,看起来不专业 | 始终使用2D |
| 双Y轴 | 误导性强,难以阅读 | 使用两个独立图表 |
| 柱状图按字母排序 | 隐藏故事性 | 按数值排序(从大到小) |
| 坐标轴无标签 | 读者无法解读 | 始终标注单位 |
| 图表垃圾(装饰元素) | 分散对数据的注意力 | 移除所有不传达信息的元素 |
| 仅用红/绿编码 | 色盲用户无法读取 | 使用形状、图案或色盲友好调色板 |
Related Skills
相关技能
bash
npx skills add inference-sh/skills@pitch-deck-visuals
npx skills add inference-sh/skills@technical-blog-writing
npx skills add inference-sh/skills@competitor-teardownBrowse all apps:
infsh app listbash
npx skills add inference-sh/skills@pitch-deck-visuals
npx skills add inference-sh/skills@technical-blog-writing
npx skills add inference-sh/skills@competitor-teardown浏览所有应用:
infsh app list