- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Matplotlib library is built upon Numpy. It is a Python library that is used to visualize data. It is a tree−like hierarchical structure which consists of objects that makeup each of these plots.

A ’Figure’ in Matplotlib can be understood as the outermost storage for a graph. This ‘Figure’ can contains multiple ‘Axes’ objects. ‘Axes’ object is NOT the plural form of ‘Axis’ in this case.

‘Axes’ can be understood as a part of ‘Figure’, a subplot. It can be used to manipulate every part of the graph inside it. A ‘Figure’ object in Matplotlib is a box that stores one or more ‘Axes’ objects. Under ‘Axes’ comes the tick marks, lines, legends, and text boxes in the hierarchy. Every object in the Matplotlib can be manipulated.

Time series, as the name suggests, is data that contains certain time periods or time stamps. It contains observations over certain time period. This kind of data tells us about how variables change over time based on various factors. Time series analysing and forecasting can be used to predict data with respect to some future time.

Time series, as the name suggests, is data that contains certain time periods or time stamps. It contains observations over certain time period. This kind of data tells us about how variables change over time based on various factors. Time series analysing and forecasting can be used to predict data with respect to some future time.

Following is an example −

import pandas as pd import matplotlib.pyplot as plt from datetime import datetime my_date = ['01−01−2018', '01−02−2018', '01−03−2018','01−04−2018', '01−05−2018', '01−06−2018', '01−07−2018', '01−08−2018'] my_price= [1,2,3,4,5,6,7,8] my_df = pd.DataFrame(my_date, my_price) my_df['value'] = [67, 99, 88, 34, 101, 21, 56, 77] my_df.columns = ['my_date', 'my_vals'] my_df['my_date'] = pd.to_datetime(my_df['my_date']) my_df.index = my_df['my_date'] del my_df['my_date'] my_df.plot(figsize=(15, 6)) plt.show()

The required packages are imported.

Data is generated and stored in a dataframe.

The ‘dates’ are converted to ‘datetime’ type.

The date column is stored as the index of the dataframe.

The plot is displayed on the console.

- Related Questions & Answers
- How can Bokeh be used to generate sinusoidal waves in Python?
- How can Bokeh be used to generate patch plot in Python?
- How can Bokeh be used to generate scatter plot using Python?
- How can Pygal be used to generate line plots in Python?
- How can Pygal be used to generate box plots in Python?
- How can Pygal be used to generate Funnel plots in Python?
- How can Pygal be used to generate Gauge plots in Python?
- How can Pygal be used to generate dot plots in Python?
- How can matplotlib be used to create histograms using Python?
- How can Bokeh library be used to generate line graphs in Python?
- How can Bokeh be used to generate candle stick plot in Python?
- How can Tensorflow text be used to preprocess text data?
- Annotate Time Series plot in Matplotlib
- How can Tensorflow be used to visualize the data using Python?
- How can Tensorflow be used to standardize the data using Python?

Advertisements