GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Python Tutorial
  • Data Types
  • Interview Questions
  • Examples
  • Quizzes
  • DSA Python
  • Data Science
  • NumPy
  • Pandas
  • Practice
  • Django
  • Flask
  • Introduction
  • Installation

This view

  • Original page
  • New address

GeezerVison is showing www.geeksforgeeks.org — Matplotlib Tutorial - GeeksforGeeks

geeksforgeeks
search icon
  • Courses
  • Tutorials
  • Interview Prep
  • Python Tutorial
  • Data Types
  • Interview Questions
  • Examples
  • Quizzes
  • DSA Python
  • Data Science
  • NumPy
  • Pandas
  • Practice
  • Django
  • Flask

Matplotlib Tutorial

Last Updated : 24 Feb, 2026

Matplotlib is an open-source library for creating static, animated and interactive visualizations in Python. Its object-oriented API enables the embedding of plots into applications developed with GUI toolkits such as Tkinter, Qt and GTK.

  • It supports line plots, bar charts, histograms, scatter plots and 3D visualizations.
  • Provides full command over figure elements, including axes, labels, legends and colors.
  • Built to work with NumPy arrays and Pandas DataFrames.
  • Compatible with multiple general-purpose GUI toolkits (Tkinter, Qt, GTK and wxPython).
  • Capable of generating high-quality output in various hardcopy formats (PNG, PDF, SVG).

Why to Use Matplotlib

  • Pyplot Module: Provides a procedural, MATLAB-like interface that simplifies plot generation for quick data exploration.
  • Architecture (Figure vs. Axes): A Figure acts as the overall top-level container, while Axes refers to the actual area where data is plotted-allowing for multiple plots within a single window.
  • High-Level Customization: Enables precise control over visual aesthetics, including titles, legends, color maps and complex figure layouts (subplots).
  • Interactive Widgets: Includes a dedicated module for adding sliders, buttons and checkboxes directly to plots for dynamic data manipulation.

Introduction

This covers installation via package managers and environment configuration.

  • Introduction
  • Installation
  • Using Jupyter Notebook for Visualizations

Plotting with Matplotlib

Generate fundamental 2D and 3D primitives. This covers the implementation of standard mathematical and statistical geometries.

  • Basic graph
  • Line Chart
  • Bar Plot
  • Scatter Plots
  • Histograms
  • Pie Charts

Customizating Plots

It allows us to manipulate Figure and Axes properties. Adjust spatial layouts, typography, grid specifications and transparency (alpha) levels.

  • Markers
  • Adding Labels
  • Configuring Grid
  • Creating Subplots
  • Styling Plots
  • Resize a Plot
  • Adjust Plot Transparency
  • Change Fonts
  • Setting Tick Label Font Size
  • Change Plot Background Color
  • Move Axis Labels
  • Hide Axis, Borders & Extra Space

Advanced Plotting

Model multidimensional data using 3D surface projections, heatmaps and contour plots. This includes using matplotlib.animation to visualize temporal state transitions and dynamic data streams.

  • Creating 3D Plots
  • Surface & Wireframe Plots
  • Heatmaps & Contour Plots
  • Animating Plots with

Saving and Exporting Plots

Save your visualizations in various formats for reports and presentations.

  • Saving Plots as PNG, JPG & SVG
  • Exporting Plots to PDF
  • Saving Multiple Figures

Toolkits in Matplotlib

Several toolkits extend Matplotlib's functionality, some of which are external downloads, while others are included with Matplotlib but have external dependencies.

  • Seaborn: A high-level statistical data visualization library built on top of Matplotlib, extremely popular for creating attractive and informative statistical graphics with minimal code.
  • Mplot3d: Integrated into Matplotlib itself, this toolkit is the go‑to choice for creating 3‑D plots with ease and flexibility.
  • GeoPandas: A library that leverages Matplotlib for geospatial plotting, simplifying the handling of geospatial data without needing a spatial database.

Matplotlib with Pandas and Seaborn

Integrate Matplotlib with Pandas and Seaborn for enhanced data visualization.

  • Matplotlib with Pandas DataFrames
  • Visualizing Time Series Data
  • Combining Seaborn & Matplotlib
  • Creating Pair Plots
  • Correlation Heatmaps

Quiz

Test your knowledge of Matplotlib with this quiz. It covers essential topics such as plotting techniques, customization and integration with other libraries.

  • Basics Quiz

Projects

  • Creating a 3D Sine Wave
  • Visualizing Bubble Sor
  • Merge Sort Visualization
  • Quick Sort Visualization
  • 3D Quick Sort Visualization
  • 3D Merge Sort Visualization
  • 3D Insertion Sort Visualization
  • Create a Time Series Plot with Rolling Average
  • Plotting Different Sounds
  • Visualizing COVID-19 Data
  • Analyzing Used Car Prices
Comment

Explore

    Python Fundamentals
    • Introduction1 min read
    • Input & Output2 min read
    • Variables4 min read
    • Operators4 min read
    • Keywords2 min read
    • Data Types4 min read
    • Conditional Statements3 min read
    • Loops3 min read
    • Functions4 min read
    Python Data Structures
    • String4 min read
    • List3 min read
    • Tuples3 min read
    • Dictionary3 min read
    • Set2 min read
    • Arrays5 min read
    Advanced Python
    • OOP Concepts3 min read
    • Exception Handling5 min read
    • File Handling4 min read
    • Python Database2 min read
    • MongoDB3 min read
    • MySQL7 min read
    • Packages4 min read
    • Modules3 min read
    • DSA Libraries5 min read
    • Python GUI2 min read
    Data Science with Python
    • Numpy3 min read
    • Pandas4 min read
    • Matplotlib3 min read
    • Seaborn3 min read
    • StatsModel2 min read
    • Model Building6 min read
    • TensorFlow2 min read
    • PyTorch5 min read
    Web Development with Python
    • Flask3 min read
    • Django5 min read
    • Django ORM4 min read
    • Jinja2 Templating5 min read
    • Django Templates5 min read
    • REST API3 min read
    • Build API with DRF4 min read
    Python Practice
    • Quiz1 min read
    • Practice Problems2 min read
    • Interview Q & A15+ min read
    Courses
    • Placement 360 Course2 min read
    • Data Science 360 Course2 min read
    • AI Engg Course2 min read
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.