SlideShare a Scribd company logo
1 of 25
Download to read offline
GVK CHINMAYA VIDYALAYA
SENIOR SECONDARY SCHOOL
Kothuru, Indukurupet, SPS Nellore
Data Visualization pyplot
Class: 12 Subject: Python Teacher: C Vijaya
B.Tech,MBA
Matplotlib is one of the most popular Python packages used for data visualization. It is a
cross-platform library for making 2D plots from data in arrays. Matplotlib is written in Python and
makes use of NumPy, the numerical mathematics extension of Python. It can be used in Python
and IPython shells, Jupyter notebook and web application servers also.
Matplotlib has a procedural interface named the Pylab, which is designed to resemble MATLAB,
a proprietary programming language developed by MathWorks. Matplotlib along with NumPy
can be considered as the open source equivalent of MATLAB.
Line Chart
The line chart is represented by a series of data points connected with a straight line.Generally,
line charts are used to display trends over time. A line chart or line graph can be created using the
plot() function available in pyplot library.We can not only just plot a line but we can explicitly define
the grid, the x and y-axis scale and labels, title and display options.
Sample Python Program to Draw Line Chart
Bar Chart using Python PyPlot
A bar chart/bar graph, is a very common two-dimensional data visualization
made up of rectangular bars, each for a specific category and it’s length
represents the value of that category.
Pie Chart using PyPlot
A pie graph/pie chart is a specialized graph used in statistics. The independent
variable is plotted around a circle.Pie Charts shows proportions and
percentages between categories, by dividing a circle into proportional
segments/parts. Each arc length represents a proportion of each category,
while the full circle represents the total sum of all the data, equal to 100%.
Line chart Example 1
Different Color Codes:
● b : blue.
● g : green.
● r : red.
● c : cyan.
● m : magenta.
● y : yellow.
● k : black.
● w : white.
Line Chart Example 2
Line Chart Example 3
A bar plot or bar chart is a graph that represents the category of
data with rectangular bars with lengths and heights that is
proportional to the values which they represent. The bar plots can
be plotted horizontally or vertically. A bar chart describes the
comparisons between the discrete categories. One of the axis of
the plot represents the specific categories being compared, while
the other axis represents the measured values corresponding to
those categories.
Bar chart
Bar Chart
Multiple Bar Charts Example 1
Multiple Bar Charts Example 2
Pie Chart
“%5d”,”%5i” ==> width=5, type=d or i (integer type)
Eg: actual value 123 is printed as __123,because 123 consists only 3 digits
the ouput is padded with 2 blanks.
“%05d”,”%05i” ==> Flag=0 ,width=5, type=d or i (integer type ie..no
decimal point)
Eg:Actual value 123 is printed as 00123,the output is padded with 2
leading zeros to make it have width of 5 digits
Examples of format strings
“%03d%%”,”%3i%%” ⇒ width=3 type=d or i (integer type), percentage
sign in the last.
Eg: Actual value 123 is printed as 123%, no leading zero as the width 3 is
fully filled.
“%6.2f”,”%6.2F” ⇒ width=6, precision=2, type=f(float type)
Eg: Actual value 123 is printed as 123.00
“%6.2f%%”,”%6.2F%%” ⇒ width=6, precision=2, type=f(float type)
Eg: Actual value 123 is printed as 123.00%
Pie Chart Example 1
Pie Chart Example 2
Labels of slices
Adding formatted slice
Pie Chart Example 3
Exploding a slice
Data visualization pyplot

More Related Content

What's hot (7)

Application of linear algebra in cse
Application of linear algebra in cseApplication of linear algebra in cse
Application of linear algebra in cse
 
Machine learning
Machine learningMachine learning
Machine learning
 
Applications of linear algebra in field of it
Applications of linear algebra in field of itApplications of linear algebra in field of it
Applications of linear algebra in field of it
 
Interpolation and-its-application
Interpolation and-its-applicationInterpolation and-its-application
Interpolation and-its-application
 
Data visualization using py plot part i
Data visualization using py plot part iData visualization using py plot part i
Data visualization using py plot part i
 
Uses Of Calculus is Computer Science
Uses Of Calculus is Computer ScienceUses Of Calculus is Computer Science
Uses Of Calculus is Computer Science
 
Count-Min Tree Sketch : Approximate counting for NLP tasks
Count-Min Tree Sketch : Approximate counting for NLP tasksCount-Min Tree Sketch : Approximate counting for NLP tasks
Count-Min Tree Sketch : Approximate counting for NLP tasks
 

Similar to Data visualization pyplot

Edge Representation Learning with Hypergraphs
Edge Representation Learning with HypergraphsEdge Representation Learning with Hypergraphs
Edge Representation Learning with Hypergraphs
MLAI2
 
CIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & CourseworkCIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & Coursework
TUOS-Sam
 

Similar to Data visualization pyplot (20)

12-IP.pdf
12-IP.pdf12-IP.pdf
12-IP.pdf
 
Python for Data Science
Python for Data SciencePython for Data Science
Python for Data Science
 
Data Visualization 2020_21
Data Visualization 2020_21Data Visualization 2020_21
Data Visualization 2020_21
 
Visualization and Matplotlib using Python.pptx
Visualization and Matplotlib using Python.pptxVisualization and Matplotlib using Python.pptx
Visualization and Matplotlib using Python.pptx
 
Introduction to Matplotlib Library in Python.pptx
Introduction to Matplotlib Library in Python.pptxIntroduction to Matplotlib Library in Python.pptx
Introduction to Matplotlib Library in Python.pptx
 
Python For Machine Learning
Python For Machine LearningPython For Machine Learning
Python For Machine Learning
 
UNIT_4_data visualization.pptx
UNIT_4_data visualization.pptxUNIT_4_data visualization.pptx
UNIT_4_data visualization.pptx
 
Chart and graphs in R programming language
Chart and graphs in R programming language Chart and graphs in R programming language
Chart and graphs in R programming language
 
A Subgraph Pattern Search over Graph Databases
A Subgraph Pattern Search over Graph DatabasesA Subgraph Pattern Search over Graph Databases
A Subgraph Pattern Search over Graph Databases
 
MATLAB
MATLABMATLAB
MATLAB
 
Graphs in Biostatistics
Graphs in Biostatistics Graphs in Biostatistics
Graphs in Biostatistics
 
Tips and Tricks for Data Visualization in Python
Tips and Tricks for Data Visualization in PythonTips and Tricks for Data Visualization in Python
Tips and Tricks for Data Visualization in Python
 
Graphs and chars
Graphs and charsGraphs and chars
Graphs and chars
 
Edge Representation Learning with Hypergraphs
Edge Representation Learning with HypergraphsEdge Representation Learning with Hypergraphs
Edge Representation Learning with Hypergraphs
 
PYTHON-Chapter 4-Plotting and Data Science PyLab - MAULIK BORSANIYA
PYTHON-Chapter 4-Plotting and Data Science  PyLab - MAULIK BORSANIYAPYTHON-Chapter 4-Plotting and Data Science  PyLab - MAULIK BORSANIYA
PYTHON-Chapter 4-Plotting and Data Science PyLab - MAULIK BORSANIYA
 
Introduction to Pylab and Matploitlib.
Introduction to Pylab and Matploitlib. Introduction to Pylab and Matploitlib.
Introduction to Pylab and Matploitlib.
 
CIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & CourseworkCIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & Coursework
 
Application of Graph Theory in Computer science using Data Structure.pdf
Application of Graph Theory in Computer science using Data Structure.pdfApplication of Graph Theory in Computer science using Data Structure.pdf
Application of Graph Theory in Computer science using Data Structure.pdf
 
Data visualization using R
Data visualization using RData visualization using R
Data visualization using R
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
 

More from chinthala Vijaya Kumar

More from chinthala Vijaya Kumar (11)

GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
 
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
 
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
 
Inserting an element in a sorted array using traditional algorithm
Inserting an element in a sorted array using traditional algorithmInserting an element in a sorted array using traditional algorithm
Inserting an element in a sorted array using traditional algorithm
 
Binary search in Python using recursion
Binary search in Python using recursionBinary search in Python using recursion
Binary search in Python using recursion
 
Linear search python CBSE Class 12
Linear search python CBSE Class 12Linear search python CBSE Class 12
Linear search python CBSE Class 12
 
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
 
Bubble sort
Bubble sortBubble sort
Bubble sort
 
Python Fundamentals Class 11
Python Fundamentals Class 11Python Fundamentals Class 11
Python Fundamentals Class 11
 
File handling CBSE CLASS 12
File handling CBSE CLASS 12File handling CBSE CLASS 12
File handling CBSE CLASS 12
 
Recursion CBSE Class 12
Recursion CBSE Class 12Recursion CBSE Class 12
Recursion CBSE Class 12
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 

Recently uploaded (20)

ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 

Data visualization pyplot

  • 1. GVK CHINMAYA VIDYALAYA SENIOR SECONDARY SCHOOL Kothuru, Indukurupet, SPS Nellore Data Visualization pyplot Class: 12 Subject: Python Teacher: C Vijaya B.Tech,MBA
  • 2. Matplotlib is one of the most popular Python packages used for data visualization. It is a cross-platform library for making 2D plots from data in arrays. Matplotlib is written in Python and makes use of NumPy, the numerical mathematics extension of Python. It can be used in Python and IPython shells, Jupyter notebook and web application servers also. Matplotlib has a procedural interface named the Pylab, which is designed to resemble MATLAB, a proprietary programming language developed by MathWorks. Matplotlib along with NumPy can be considered as the open source equivalent of MATLAB.
  • 3.
  • 4. Line Chart The line chart is represented by a series of data points connected with a straight line.Generally, line charts are used to display trends over time. A line chart or line graph can be created using the plot() function available in pyplot library.We can not only just plot a line but we can explicitly define the grid, the x and y-axis scale and labels, title and display options.
  • 5. Sample Python Program to Draw Line Chart
  • 6.
  • 7. Bar Chart using Python PyPlot A bar chart/bar graph, is a very common two-dimensional data visualization made up of rectangular bars, each for a specific category and it’s length represents the value of that category.
  • 8. Pie Chart using PyPlot A pie graph/pie chart is a specialized graph used in statistics. The independent variable is plotted around a circle.Pie Charts shows proportions and percentages between categories, by dividing a circle into proportional segments/parts. Each arc length represents a proportion of each category, while the full circle represents the total sum of all the data, equal to 100%.
  • 10. Different Color Codes: ● b : blue. ● g : green. ● r : red. ● c : cyan. ● m : magenta. ● y : yellow. ● k : black. ● w : white.
  • 12.
  • 14. A bar plot or bar chart is a graph that represents the category of data with rectangular bars with lengths and heights that is proportional to the values which they represent. The bar plots can be plotted horizontally or vertically. A bar chart describes the comparisons between the discrete categories. One of the axis of the plot represents the specific categories being compared, while the other axis represents the measured values corresponding to those categories. Bar chart
  • 16. Multiple Bar Charts Example 1
  • 17. Multiple Bar Charts Example 2
  • 19. “%5d”,”%5i” ==> width=5, type=d or i (integer type) Eg: actual value 123 is printed as __123,because 123 consists only 3 digits the ouput is padded with 2 blanks. “%05d”,”%05i” ==> Flag=0 ,width=5, type=d or i (integer type ie..no decimal point) Eg:Actual value 123 is printed as 00123,the output is padded with 2 leading zeros to make it have width of 5 digits Examples of format strings
  • 20. “%03d%%”,”%3i%%” ⇒ width=3 type=d or i (integer type), percentage sign in the last. Eg: Actual value 123 is printed as 123%, no leading zero as the width 3 is fully filled. “%6.2f”,”%6.2F” ⇒ width=6, precision=2, type=f(float type) Eg: Actual value 123 is printed as 123.00 “%6.2f%%”,”%6.2F%%” ⇒ width=6, precision=2, type=f(float type) Eg: Actual value 123 is printed as 123.00%
  • 22. Pie Chart Example 2 Labels of slices
  • 24. Pie Chart Example 3 Exploding a slice