- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to plot a time series in Python?
To plot a time series in Python using matplotlib, we can take the following steps −
Create x and y points, using numpy.
Plot the created x and y points using the plot() method.
To display the figure, use the show() method.
import matplotlib.pyplot as plt import datetime import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.array([datetime.datetime(2021, 1, 1, i, 0) for i in range(24)]) y = np.random.randint(100, size=x.shape) plt.plot(x, y) plt.show()
- How to create a time series plot in R without time vector?
- Python - Create a Time Series Plot using Line Plot with Seaborn
- How to plot a time series array, with confidence intervals displayed in Python? (Matplotlib)
- Python - Create a Time Series Plot with multiple columns using Line Plot
- How to plot multiple time series using ggplot2 in R?
- How to plot time series data with labels in R?
- How do you plot a vertical line on a time series plot in Pandas?
- How to plot a time series graph using Seaborn or Plotly?
- How can I plot two different spaced time series on one same plot in Python Matplotlib?
- Annotate Time Series plot in Matplotlib
- How to create a vertical line in a time series plot in base R?
- Plot multiple time-series DataFrames into a single plot using Pandas (Matplotlib)
- How to plot two Pandas time series on the same plot with legends and secondary Y-axis in Matplotlib?
- How to plot Time Zones in a map in Matplotlib
- How to a plot stem plot in Matplotlib Python?