Skip to main content

Python | Introduction to Matplotlib(Only for knowledge)

 Python | Introduction to Matplotlib) Date:ndsfbdbfhfhdgfdh

Matplotlib is an amazing visualization library in Python for 2D plots of arrays. 

Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. 


It was introduced by John Hunter in the year 2002.

One of the greatest benefits of visualization is that it allows us visual access to huge amounts of data in easily digestible visuals. 


Matplotlib consists of several plots like line, bar, scatter, histogram etc.

Installation :
Windows, Linux and macOS distributions have matplotlib and most of its dependencies as wheel packages. Run the following command to install matplotlib package :

python -mpip install -U matplotlib

 
Importing matplotlib :

from matplotlib import pyplot as plt
or
import matplotlib.pyplot as plt 

Basic plots in Matplotlib :

Matplotlib comes with a wide variety of plots. Plots helps to understand trends, patterns, and to make correlations. They’re typically instruments for reasoning about quantitative information. Some of the sample plots are covered here.



Line plot :

filter_none

brightness_4

# importing matplotlib module 
from matplotlib import pyplot as plt
  
# x-axis values
x = [5, 2, 9, 4, 7]
  
# Y-axis values
y = [10, 5, 8, 4, 2]
  
# Function to plot
plt.plot(x,y)
  
# function to show the plot
plt.show()

 Output:☺☺☺☺☺






Comments

Post a Comment

Popular posts from this blog

Input Devices

Input Devices(इनपुट डिवाइस ) Input device enables the user to send data, information or control signals to computer. Central processing unit of computer receives the input and processes it to produce output. Some of the popular input devices are: Keyboard Mouse Scanner Joystick Light Pen Track ball Digitizer Microphone Magnetic Ink Character Recognition (MICR) Optical Character Reader (OCR) Keyboard (कीबोर्ड ) It is a basic input device that is used to enter data by pressing keys. It has different sets of keys for letters, numbers, characters and functions. QWERTY keyboard is the commonly used keyboard to enter data. Mouse (माउस) It is a hand held input device. It is used to move cursor or pointer across the screen. It generally has left and right button and a scroll wheel between them. Laptop computers come with a touch pad that works as a mouse. It lets you control the movement of cursor or pointer by moving your finger over the touchpad. Scanner (...

Class 11 (22-01-2021) only for Computer Science Students

  ☺Note: All Questions are note it in your copy. Question No-1: Evaluate the following C++ expressions where a, b, c are integers and d, f are floating point numbers. The Value of a = 6, b = 2, d = 1.5  a) f = a + b/a b) c = ( a++) * d + b c) c = a – ( b++ ) * (–a) Question No:2 Explain Unary,Binary and Ternary Operators? Give Example of each type. Answer:-            Unary Operators : Operators that operates or works with a single operand are unary operators. Example: (++, –) Binary Operators : Operators that operates or works with two operands are binary operators. Example: +, –, *, /. Example: +, –, *, /.        Ternary Operator : These operator requires 3 expressions or operands to function. Example: Conditional operator- Expression1 ? Expression2 : Expression3 . Here, Expression1 is the condition to be evaluated. If the condition(Expression1) is True then we will execute and return the result of Expression2 el...

Types of computer

Types of Computer (कंप्यूटर के प्रकार ) We can categorize computer by two ways: data handling capabilities and size. On the basis of data handling capabilities , the computer is of  three  types: Analogue Computer (एनालॉग  कंप्यूटर ) Digital Computer (डिजिटल कंप्यूटर ) Hybrid Computer (हाइब्रिड कंप्यूटर ) 1) Analogue Computer(एनालॉग  कंप्यूटर ) Analog computers are designed to process analogue data. Analogue data is continuous data that changes continuously and cannot have discrete values such as speed, temperature, pressure and current. The analogue computers measure the continuous changes in physical quantity and generally render output as a reading on a dial or scale. Analogue computers directly accept the data from the measuring device without first converting it into numbers and codes. Speedometer and mercury thermometer are examples of analogue computers. 2) Digital Computer(डिजिटल कंप्यूटर) A digital computer is designed to perfor...