Matplotlib is an amazing visualization library in Python for 2D plots of arrays.Matplotlib consists of several plots like line, bar, scatter, histogram, etc.
To import Matplotlib:
from matplotlib import pyplot as plt
import matplotlib.pyplot as plt
Matplotlib has a great variety of plots available which are easy to use and help us in understanding the underlying trends, patterns of data better.
Problem: Consider the data given below and plot the required solutions.
Problem 1] Create Bar charts to see the distribution of Rainfall from Jan to Dec for all zones.
Write the data in excel sheet and save it as CSV. Copy the location of the file.
The code snippet is as follows:
Problem 2] Create Pie chart to check amount of rainfall in Jan seperately.
Problem 3] Create line chart to observe trends from Jan to Dec
In the above code snippets, Pandas is imported to read the data to plot it.Matplotlib.pyplt helps in plotting the desired visualization. Using various in-built functions of pyplot we can map data in form of bar graphs, line graphs and pie charts.
To view all the lessons in chapter 8: https://computertutor.in/class-12-computer-science/chapter-8/
To view entire class 12 computer science study material: https://computertutor.in/resources/
You cannot copy content of this page