Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

πŸ€– Artificial Intelligence
☁️ Cloud and Infrastructure
πŸ’Ύ Data and Databases
πŸ’Ό Professional Skills
🎯 Programming and Development
πŸ”’ Security and Networking
πŸ“š Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 0
0/5 XP
GitHub
Β© 2026 CheatGridβ„’. All rights reserved.
Privacy PolicyTerms of UseAboutContact

Matplotlib Cheat Sheet

Matplotlib Cheat Sheet

Back to Data Science
Updated 2026-04-27
Next Topic: Missing Data Analysis and Imputation Cheat Sheet

Matplotlib is a comprehensive, low-level plotting library for Python that creates static, animated, and interactive visualizations across 2D and 3D spaces. Originally designed to mimic MATLAB's plotting interface, it has become the foundational visualization library in the Python ecosystem, serving as the backend for many higher-level tools like Seaborn and Pandas plotting. Understanding both its pyplot interface (stateful, MATLAB-like) and its object-oriented API (explicit control via Figure and Axes) is essential β€” the latter offers better scalability for complex multi-subplot layouts and production code, while pyplot excels at quick exploratory analysis.


What This Cheat Sheet Covers

This topic spans 22 focused tables and 138 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Core Plotting FunctionsTable 2: Figure and Axes CreationTable 3: Customization - Lines and MarkersTable 4: Axis Formatting and ScalingTable 5: Legends and AnnotationsTable 6: Colormaps and ColorbarsTable 7: Subplot Layout ManagementTable 8: Contour and Heatmap PlotsTable 9: 3D PlottingTable 10: Polar PlotsTable 11: Patches and ShapesTable 12: Text and Font PropertiesTable 13: Saving FiguresTable 14: AnimationTable 15: BackendsTable 16: Style Sheets and rcParamsTable 17: Advanced Axes FeaturesTable 18: Quiver and Vector Field PlotsTable 19: Statistical Plot TypesTable 20: Date PlottingTable 21: Event HandlingTable 22: Object-Oriented vs Pyplot Interface

Table 1: Core Plotting Functions

FunctionExampleDescription
plot
plt.plot(x, y, 'r--')
β€’ Line plot connecting data points
β€’ accepts format strings for color, marker, and linestyle in compact notation.
scatter
plt.scatter(x, y, s=50, c='blue')
β€’ Scatterplot for visualizing relationships
β€’ supports variable marker sizes and colors via arrays.
bar
plt.bar(categories, values)
β€’ Vertical bar chart
β€’ use barh() for horizontal orientation.
hist
plt.hist(data, bins=20)
Histogram showing distribution of a single variable across binned ranges.
boxplot
plt.boxplot([data1, data2])
Box-and-whisker plot displaying quartiles and outliers for statistical distributions.
fill_between
plt.fill_between(x, y1, y2)
β€’ Shaded region between two curves
β€’ commonly used for confidence intervals.
errorbar
plt.errorbar(x, y, yerr=err)
β€’ Plot with error bars showing uncertainty
β€’ accepts symmetric or asymmetric errors.

More in Data Science

  • Jupyter and JupyterLab Cheat Sheet
  • Missing Data Analysis and Imputation Cheat Sheet
  • AB Testing and Online Experimentation Cheat Sheet
  • Design of Experiments (DOE) Cheat Sheet
  • OpenRefine Cheat Sheet
  • SciPy Cheat Sheet
View all 47 topics in Data Science