- Grouped bars: side-by-side category comparison
- Stacked bars: part-to-whole within a category
- Horizontal bars: ideal for long category labels
- Data labels via
ax.text() for exact values
- Single and multi-line time series comparison
- Dual y-axis:
ax.twinx() for different scales - Area fill:
ax.fill_between() for cumulative views - Annotate periods:
ax.axvspan() for highlights
ax.pie(values, labels, autopct="%1.1f%%")- Explode a slice:
explode=[0.1, 0, 0, 0] - Donut: add a white circle patch to the center
- Best for: ≤5 categories showing composition only
- Trend over time → line chart
- Category comparison → bar chart
- Composition / share → pie or stacked bar
- Correlation → scatter; distribution → histogram
- PNG for reports and presentations (300 DPI)
- SVG for scalable web and print graphics
- PDF for vector-quality document embedding
bbox_inches="tight" prevents cropped labels
- Part A: Product category grouped & stacked bar chart
- Part B: Monthly sales trend with area fill and dual axis
- Create a donut chart for market share composition
- Export all charts at 300 DPI with descriptive filenames