Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • DSA
  • Practice Problems
  • Python
  • C
  • C++
  • Java
  • Courses
  • Machine Learning
  • DevOps
  • Web Development
  • System Design
  • Aptitude
  • Projects
Open In App
Next Article:
How to Install Matplotlib on python?
Next article icon

How to Install Matplotlib on Linux?

Last Updated : 29 Sep, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

Matplotlib is a low-level library of Python which is used for data visualization. It is easy to use and emulates MATLAB like graphs and visualization. This library is built on the top of NumPy arrays and consist of several plots like line chart, bar chart, histogram, etc. It provides a lot of flexibility but at the cost of writing more code.

Environment Setup:

Matplotlib is an overall package for creating static, animated, and interactive visualizations in Python. It literally opens up a whole new world of possibilities for you! Especially when it is used with Numpy or Pandas library, one can do unimaginable things. The plots give may give a new insight altogether. Now, the question arises i.e. How to make it running on your computer? But a more primary question would be, what are its pre-requisites or as we call it, dependencies for the software to run on your computer?

Dependencies:

  • Python (>= 3.6)
  • FreeType (>= 2.3)
  • libpng (>= 1.2)
  • NumPy (>= 1.11)
  • setuptools
  • cycler (>= 0.10.0)
  • dateutil (>= 2.1)
  • kiwisolver (>= 1.0.0)
  • pyparsing

Installation on Linux:

We will use the pip command to install this module. If you do not have pip installed then refer to the article, Download and install pip Latest Version.

To install Matplotlib type the below command in the terminal:

pip install matplotlib

You will get the following message once the installation is complete:

installing matplotlib

Let's see some examples of using matplotlib:

Example 1: Creating Line plots

Python3
# 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:


 


 

Example 2: Creating Bar plots


 

Python3
# 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 the bar plt.bar(x,y)  # function to show the plot plt.show() 

Output:

Example 3: Creating Scatter plots

Python3
# 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 scatter plt.scatter(x, y)  # function to show the plot plt.show() 

Output:


Next Article
How to Install Matplotlib on python?

D

ddeevviissaavviittaa
Improve
Article Tags :
  • TechTips
  • How To
  • Installation Guide
  • Blogathon
  • Blogathon-2021
  • how-to-install

Similar Reads

  • How to Install Matplotlib on MacOS?
    In this article, we will learn how to install Matplotlib in Python on MacOS. Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Installation:Method 1: Using pip to install Matplotlib Package Follow the below steps to install the Matplotlib
    2 min read
  • How to Install Numpy on Linux?
    Python NumPy is a general-purpose array processing package that provides tools for handling n-dimensional arrays. It provides various computing tools such as comprehensive mathematical functions, linear algebra routines. NumPy provides both the flexibility of Python and the speed of well-optimized c
    2 min read
  • How to Install NuPIC on Linux?
    NuPIC (short for "Numenta Platform for Intelligent Computing") is an open-source platform for machine learning and artificial intelligence. It was developed by Numenta, a company founded by Jeff Hawkins, the creator of the PalmPilot and the co-founder of Handspring. NuPIC is based on the theory of t
    4 min read
  • How to Install Matplotlib on python?
    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. In this article, we will look into the various process of installing Matplotlib on Windo
    2 min read
  • How to Install GD module on Linux?
    GD is a python library. It provides various features and an async-ready API wrapper for the geometry dash. It is easy to use. It is used to implement the geometry dash API and is also very handy to work with object-oriented design. Installing GD module on Linux Method 1: Using pip to install GD Pack
    2 min read
  • How to Install Matplotlib on Anaconda?
    Matplotlib is a Python library for data visualization that allows users to create static, interactive, and animated plots. If you're using Anaconda, a leading platform for Python data science, installing Matplotlib is straightforward. This guide provides you with detailed instructions to install Mat
    2 min read
  • How to Install Python on Linux
    This guide explains how to install Python on Linux machines. Python has become an essential programming language for developers, data scientists, and system administrators. It's used for various applications, including web development, data science, automation, and machine learning. This comprehensi
    15+ min read
  • How to Install Pillow on Linux?
    In this article, we will look into the various methods of installing the PIL package on a Linux machine. Python Imaging Library (expansion of PIL) is the de facto image processing package for Python language. It incorporates lightweight image processing tools that aid in editing, creating, and savin
    2 min read
  • How to Install Seaborn on Linux?
    Seaborn is a library mostly used for statistical plotting in Python. It is built on top of Matplotlib and provides beautiful default styles and color palettes to make statistical plots more attractive. Seaborn Dependencies: Seaborn has the following dependencies: Python 3.4+numpyscipypandasmatplotli
    2 min read
  • How to Install Rasterio on Linux?
    Rasterio is a python library for reading and writing on geospatial raster datasets. It is a GDAL and NumPy-based Python library for raster data. We can use any of the following methods to install Rasterio on our Linux machine. Method 1: Using pip command Prerequisites: We must have pip ( a python pa
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences