Matplotlib Tutorial
Learn to turn raw numbers into clear, beautiful charts with Python's most popular plotting library — 50 lessons from Beginner to Advanced.
Learn Matplotlib from scratch — line, bar, scatter and pie charts, subplots, styling and dashboards — free interactive lessons.
Part of the free Matplotlib course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
Begin with Lesson 1 and build real charting skills step by step — at your own pace.
Lessons in this course
- Introduction to Matplotlib — What Matplotlib is, why it matters, and how to install and import it
- The Figure & Axes — Understand the Figure and Axes objects that hold every plot
- Your First Line Plot — Draw a line chart from lists of x and y data with plt.plot
- Labels, Titles & Legends — Add axis labels, a title, and a legend to make charts readable
- Markers, Line Styles & Colors — Control the look of your lines with colors, dashes, and markers
- Saving Figures — Export charts to PNG, SVG, and PDF with savefig and the right DPI
- Bar Charts — Compare categories with vertical, horizontal, and grouped bars
- Histograms — Show the distribution of a dataset with bins and frequencies
- Scatter Plots — Plot relationships between two variables point by point
- Pie Charts — Show parts of a whole with percentages, labels, and explode
- Subplots & Layouts — Arrange multiple charts in a grid with plt.subplots
- Styling & Themes — Apply built-in style sheets to restyle every chart instantly
- Annotations & Text — Highlight key points with text, arrows, and annotate
- Plotting with Dates — Plot time series and format date ticks on the x-axis
- Twin Axes & Secondary Y — Plot two different scales on one chart with twinx
- Plotting with Pandas — Chart DataFrames directly using the pandas .plot() interface
- Heatmaps & imshow — Visualize 2D grids and matrices with color and a colorbar
- 3D Plots — Render 3D surfaces and scatter plots with mplot3d
- Customizing with rcParams — Set global defaults for fonts, colors, and sizes with rcParams
- Box & Violin Plots — Show distributions and outliers with boxplot and violinplot
- Grouped & Stacked Bar Charts — Compare categories side-by-side or stacked, with value labels
- Error Bars & Confidence Bands — Show uncertainty with errorbar and shaded confidence bands
- Filling Areas (fill_between) — Shade regions between curves and build confidence bands
- Stem, Step & Stair Plots — Plot discrete signals and step functions
- Polar Plots — Plot in polar coordinates — radar-style and circular data
- Density: hexbin & hist2d — Reveal 2D density when a scatter plot is overplotted
- Stack Plots & Area Charts — Show how parts add up over time with stacked areas
- Checkpoint: Chart Types — Pick the right chart for the data in a multi-panel build — then a quiz
- Complex Layouts with GridSpec — Build magazine-style layouts with GridSpec and subplot_mosaic
- Colormaps & Normalization — Choose perceptually-uniform colormaps and control value mapping
- Colorbars — Add, label, and share colorbars across plots
- Contour & Filled Contour Plots — Visualise 3D surfaces in 2D with contour and contourf
- Displaying Images & Matrices (imshow) — Render arrays and images with imshow, extent, and interpolation
- Tick Locators & Formatters — Control tick placement and format axes as %, currency, or dates
- Text, Math & LaTeX in Plots — Add annotations, arrows, and math with mathtext
- Animations (FuncAnimation) — Build frame-by-frame animations and export them to GIF/MP4
- Checkpoint: Advanced Plotting — Combine GridSpec, a heatmap, custom ticks and annotations — then a quiz
- Vector Fields (quiver & streamplot) — Draw arrows and flow lines for vector and field data
- Customizing Spines & Axis Position — Hide, move, and restyle the axis spines for a clean look
- Advanced Legends — Place legends outside the axes, use custom handles, and multiple legends
- Inset & Broken Axes — Add zoom-in insets and broken-axis effects
- Drawing Shapes (Patches) — Add rectangles, circles, and polygons to highlight regions
- Interactive Event Handling — Respond to clicks, key presses, and mouse motion on a figure
- Managing Multiple Figures — Juggle several figures, the current figure, and closing them
- Adding Tables to Plots — Embed a data table beneath or beside a chart
- Logarithmic & Symlog Scales — Reveal patterns across orders of magnitude with log axes
- More Plot Types: eventplot, broken_barh, stairs — Timelines, Gantt-style bars, and step outlines
- Donut & Nested Pie Charts — Build donut charts and nested rings with wedge properties
- Checkpoint: Data Visualization — Combine several advanced techniques into one polished figure — then a quiz
- Capstone: Build a Dashboard — Combine everything into a multi-panel data dashboard