Skip to Content

How to Plot Histograms by Group in Pandas

In this tutorial, we’ll try to understand how to plot histograms by group in pandas with the help of some examples. Plotting histograms using grouped data from a pandas DataFrame creates one histogram for each group in the DataFrame. For example, you group the data by values of column 1 and then show the distribution …

Read More about How to Plot Histograms by Group in Pandas

How to Create a Contour Plot in Matplotlib

In this tutorial, we’ll try to understand how to create a contour plot in matplotlib. A contour plot is a type of plot that allows us to visualize three-dimensional data in two dimensions by using contours. Contours are concentric lines that represent a magnitude. To create a contour plot in matplotib you can use the …

Read More about How to Create a Contour Plot in Matplotlib

Pandas – Plot Multiple Dataframes in Subplots

In this tutorial, we will look at how to plot multiple pandas dataframes on a grid of subplots (each dataframe on a separate subplot) with the help of some examples. Steps to plot dataframes on different subplots To plot multiple dataframe on a subplot, take the following steps – The following is the syntax – …

Read More about Pandas – Plot Multiple Dataframes in Subplots

How to Create Multiple Matplotlib Plots in One Figure?

In this tutorial, we’ll try to understand how to create multiple matplotlib plots in one figure with the help of some examples. To create multiple plots in a single figure in matplotlib, you can use the matplotlib.pyplot.subplots() function. This creates a grid of subplots in a single figure with each subplot represented by a different …

Read More about How to Create Multiple Matplotlib Plots in One Figure?

How To Make a Bubble Plot in Python with Matplotlib?

In this tutorial, we’ll try to understand how to make a bubble plot in python using the matplotlib library. A bubble plot is a scatterplot, but with the size of the data points on the scatter plot represented by another variable. Basically, if the size variable is larger you get a bigger circle filled with …

Read More about How To Make a Bubble Plot in Python with Matplotlib?

Matplotlib – Create a Plot with two Y Axes and shared X Axis

In this tutorial, we’ll try to understand how to create a matplotlib plot with two Y axes and a shared X axis and why it is used. You might occasionally want to create a single plot that has two variables with different scales as part of a brief exploratory data study. Making a single plot …

Read More about Matplotlib – Create a Plot with two Y Axes and shared X Axis

Fill Area Between Lines in Matplotlib

In this tutorial, we’ll try to understand how to fill in the area between lines in a matplotlib plot with the help of examples. We can easily fill in the area between lines in a Matplotlib plot by using the following functions available in the matplotlib.pyplot module: Using the matplotlib.pyplot.fill_between() method It is a method …

Read More about Fill Area Between Lines in Matplotlib

How to Draw a Rectangle in a Matplotlib Plot?

In this tutorial, we’ll try to understand how to draw a rectangle in matplotlib with the help of some examples. We can directly use matplotlib.patches.Rectangle class to draw a rectangle in matplotlib. Basic Syntax: Parameters: For more parameters, refer to this. Examples Now, let us try to understand the above method using worked-out examples. Example …

Read More about How to Draw a Rectangle in a Matplotlib Plot?

How to set the aspect ratio in Matplotlib?

In this tutorial, we’ll try to understand how to set the aspect ratio of a plot in Matplotlib with the help of some examples. Before looking at how to set an aspect ratio, let us first understand what is the aspect ratio. In matplotlib, the Aspect ratio is simple, the ratio of length to width …

Read More about How to set the aspect ratio in Matplotlib?