# Matplotlib

## Matplotlib — A Simple Guide with Videos

Matplotlib with Python is the most powerful combination in the area of data visualization and data science. This guide takes 25 minutes of your time—if you watch the videos, it’ll take you 2-4 hours. But it will be a great investment of your time because it’ll make you a better coder and more effective data …

## Matplotlib Widgets — Creating Interactive Plots with Sliders

This article describes how to generate interactive plots by using the .widgets package from the matplotlib library. As can be inferred from the name, the .widgets package allows creating different types of interactive buttons, which can be used for modifying what is displayed in a matplotlib graph. In particular, this article will focus on the …

## Creating Beautiful Heatmaps with Seaborn

Heatmaps are a specific type of plot which exploits the combination of color schemes and numerical values for representing complex and articulated datasets. They are largely used in data science application that involves large numbers, like biology, economics and medicine. In this video we will see how to create a heatmap for representing the total …

## Matplotlib Line Plot – A Helpful Illustrated Guide

The line plot is the most iconic of all the plots. To draw one in matplotlib, use the plt.plot() function and pass it a list of numbers used as the y-axis values. Per default, the x-axis values are the list indexes of the passed line. Matplotlib automatically connects the points with a blue line per …

## Matplotlib Scatter Plot – Simple Illustrated Guide

Scatter plots are a key tool in any Data Analyst’s arsenal. If you want to see the relationship between two variables, you are usually going to make a scatter plot.  In this article, you’ll learn the basic and intermediate concepts to create stunning matplotlib scatter plots. Minimal Scatter Plot Example The following code shows a …

## np.polyfit() — Curve Fitting with NumPy Polyfit

The .polyfit() function, accepts three different input values: x, y and the polynomial degree. Arguments x and y correspond to the values of the data points that we want to fit, on the x and y axes, respectively. The third parameter specifies the degree of our polynomial function. For example, to obtain a linear fit, …

## Matplotlib Histogram — A Simple Illustrated Guide

The histogram is one of the most important plots for you to know. You’ll use it every time you explore a dataset. It is the go-to plot for plotting one variable.  In this article, you’ll learn the basics and some intermediate ideas. You’ll plot histograms like a pro in no time using Python and matplotlib. …

## Matplotlib Animation – A Helpful Illustrated Guide

Creating animations in matplotlib is reasonably straightforward. However, it can be tricky when starting, and there is no consensus for the best way to create them. In this article, I show you a few methods you can use to make amazing animations in matplotlib. Matplotlib Animation Example The hardest thing about creating animations in matplotlib …

## Matplotlib 3D Plot [Tutorial]

Are you tired with the same old 2D plots? Do you want to take your plots to the next level? Well look no further, it’s time to learn how to make 3D plots in matplotlib. In addition to import matplotlib.pyplot as plt and calling plt.show(), to create a 3D plot in matplotlib, you need to: …

## Matplotlib 3D Plot Advanced

If you’ve already learned how to make basic 3d plots in maptlotlib and want to take them to the next level, then look no further. In this article, I’ll teach you how to create the two most common 3D plots (surface and wireframe plots) and a step-by-step method you can use to create any shape …

## Python Lists filter() vs List Comprehension – Which is Faster?

[Spoiler] Which function filters a list faster: filter() vs list comprehension? For large lists with one million elements, filtering lists with list comprehension is 40% faster than the built-in filter() method. To answer this question, I’ve written a short script that tests the runtime performance of filtering large lists of increasing sizes using the filter() …

## How to Filter a List in Python?

How can you filter a list in Python using an arbitrary condition? The most Pythonic and most performant way is to use list comprehension [x for x in list if condition] to filter all elements from a list. Filter with List Comprehension The most Pythonic way of filtering a list—in my opinion—is the list comprehension …