1.

Explain in detail the types of pyplots using Matplotlib?

Answer»

Line Chart:

A Line Chart or Line Graph is a type of chart which displays information as a series of data points called ‘markers’ connected by straight line segments. A Line Chart is often used to visualize a trend in data over intervals of time – a time series – thus the line is often drawn chronologically. 

Example: Line plot

import matplotlib.pyplot as plt

years= [2014,2015,2016,2017,2018] 

totaljopulations = [8939007, 8954518,8960387,8956741, 8943721]

plt.plot (years, total_populations)

plt.title (“Year vs Population in India”)

plt.xlabel (“Year”)

plt.ylabel (“Total Population”)

plt.legend( )

pit. show( )

In this program,

Plt.title( ) → specifies title to the graph

Plt.xlabel( ) → specifies label for X-axis

Plt.ylabel( ) → specifies label for Y-axis



Discussion

No Comment Found