What is Matplotlib, how to install and use
Matplotlib Basics
1 min read
This section is 1 min read, full guide is 24 min read
Published Oct 5 2025
15
Show sections list
0
Log in to enable the "Like" button
0
Guide comments
0
Log in to enable the "Save" button
Respond to this guide
Guide Sections
Guide Comments
ChartsGraphsMatplotlibNumPyPandasPythonVisualisation
Matplotlib Official Documentation
This guide only goes through the basics. Matplotlib is capable of much more, visit the official site for more details.
Matplotlib is a powerful and flexible Python library used for creating static, animated, and interactive visualisations.
It’s especially popular in data science, engineering, and academic research for visualising numerical data.
Matplotlib can produce a wide range of chart types, including:
- Line charts –
plt.plot()
- Scatter plots –
plt.scatter()
- Bar charts –
plt.bar()
,plt.barh()
- Histograms –
plt.hist()
- Pie charts –
plt.pie()
- Boxplots & Violin plots –
plt.boxplot()
,plt.violinplot()
- Heatmaps & Images –
plt.imshow()
Matplotlib offers deep control over:
- Titles, labels, legends:
plt.title()
,plt.xlabel()
,plt.legend()
- Colours, markers, line styles
- Axes and scales: linear, log, polar, etc.
- Subplots and layout control:
plt.subplot()
,plt.subplots()
- Figure size and resolution:
plt.figure(figsize=(w, h), dpi=100)
Installation:
pip install matplotlib
Copy to Clipboard
Importing the library:
import matplotlib.pyplot as plt
Copy to Clipboard
By convention, it’s always imported as plt
.