2D Plots

Explore various 2D plots and subplots in MATLAB and Python.

A 2D plot, also known as a 2D plot, is a graphical representation of data in which the x-axis and y-axis represent two different variables. The data points are plotted on the graph according to their x and y values, visually representing the relationship between them. 2D plots can be used to display a wide range of information, including:

  • Mathematical functions

  • Scientific data

  • Financial trends

They are commonly used in fields such as statistics, engineering, and physics to analyze and understand complex data sets.

We are going to discuss the most common types of 2D plots in both environments.

2D line plot

A 2D line plot is a graph that displays data as a series of points connected by lines. The x-axis and y-axis represent two different variables, and the data points are plotted on the graph according to their x and y values. Line plots are commonly used to display trends over time or to show the relationship between two variables.

For example, in MATLAB, we use plot command to plot a 2D line plot as shown below.

Get hands-on with 1400+ tech skills courses.