When to use each chart type and how to create it in Python
| Chart Type | Use When | Matplotlib Function | Seaborn Function |
|---|---|---|---|
| Bar Chart | Comparing discrete categories | ax.bar() | sns.barplot() |
| Grouped Bar | Comparing categories across groups | ax.bar() with x offsets | sns.barplot(hue=) |
| Lollipop Chart | Ordered comparisons, cleaner than bars | ax.stem() | — |
| Dot Plot | Comparing ranked values | ax.scatter() | sns.stripplot() |
| Radar Chart | Comparing multiple metrics | ax.plot() on polar | — |
| Chart Type | Use When | Matplotlib Function | Seaborn Function |
|---|---|---|---|
| Histogram | Single variable distribution | ax.hist() | sns.histplot() |
| KDE Plot | Smooth distribution estimate | ax.fill_between() | sns.kdeplot() |
| Box Plot | Median, IQR, outliers | ax.boxplot() | sns.boxplot() |
| Violin Plot | Distribution shape + box plot | — | sns.violinplot() |
| Strip/Jitter | Individual data points on groups | ax.scatter() + jitter | sns.stripplot() |
| ECDF | Cumulative distribution | Manual computation | sns.ecdfplot() |
| Ridge Plot | Multiple group distributions | Manual + fill_between | via joypy |
viridis)._r suffix like viridis_r correctly.plt.tight_layout()
plt.savefig('figure.pdf', dpi=300, bbox_inches='tight')