Free JYnapse Knowledge Base · Cheat Sheet
Pick the right chart for the question, then build it. Design principles first; then matplotlib & seaborn recipes in Python.
| Compare | Bar chart |
| Over time | Line chart |
| Part of a whole | Stacked bar (not pie) |
| Relationship | Scatter plot |
| Distribution | Histogram / box plot |
| Ranking | Sorted horizontal bar |
| Two dimensions | Heatmap |
| Single number | Big number + label |
Choose the chart from the question, never the other way around.
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(8, 4.5))
ax.bar(df.month, df.sales, color="#0F3D3E")
ax.set_title("Sales fell 12% in Q3")
ax.set_ylabel("RM")
ax.spines[["top","right"]].set_visible(False)
fig.tight_layout()
fig.savefig("sales.png", dpi=150)
Always use the object API (fig, ax) — predictable and scriptable.
ax.plot(x, y) # line
ax.bar(cats, vals) # vertical bars
ax.barh(cats, vals) # horizontal (ranking)
ax.scatter(x, y, s=sizes) # scatter / bubble
ax.hist(values, bins=30) # distribution
ax.fill_between(x, lo, hi) # band
import seaborn as sns
sns.set_theme(style="whitegrid")
sns.barplot(data=df, x="month", y="sales")
sns.lineplot(data=df, x="date", y="v", hue="region")
sns.scatterplot(data=df, x="ad", y="sales")
sns.histplot(df.price, bins=30, kde=True)
sns.boxplot(data=df, x="region", y="price")
sns.heatmap(corr, annot=True, cmap="Greens")
seaborn understands DataFrames directly — one line per chart, sensible defaults, group with hue=.
import plotly.express as px
fig = px.line(df, x="date", y="sales",
color="region", title="Sales by region")
fig.show()
fig.write_html("chart.html") # embed anywhere
Use when viewers need to hover, zoom or toggle series — dashboards and web reports.
| Pie > 3 slices | Use a sorted bar |
| Dual Y-axes | Misleads; use two charts |
| 3-D anything | Distorts values |
| Truncated bar axis | Exaggerates gaps |
| Rainbow heatmaps | Not perceptually even |
| Too many series | Spaghetti — highlight one |
fig.savefig("out.png", dpi=150,
bbox_inches="tight")
fig.savefig("out.svg") # crisp for print/web
figsize up front so text stays legible after scaling.If you must explain the chart out loud, the chart isn't finished.
JYnapse Knowledge Base · Free to read and print. Python examples use matplotlib, seaborn and Plotly. Available in English, Bahasa Melayu and 中文 on request.