Line Plots
Learn how to generate line plots and change their style.
Features
A line plot is a type of visualization used to display changes in data over time. It consists of a series of data points that are connected by straight lines. We can show trends, highlight anomalies, compare multiple data series, and predict the trends with line charts. We use line plots in various fields like finance, economics, and the natural and social sciences. They are especially useful in visualizing time series data.
Line chart with plot()
The plot()
function is the built-in function for data visualization. It is capable of generating charts in various styles. To generate a line plot, we configure the function using the type = "l"
argument.
It takes at least two parameters: the name of the dataset and the type="l"
argument.
plot(<data>, type="l") # Syntax
...Get hands-on with 1400+ tech skills courses.