Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • 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
  • Pandas
  • Matplotlib
  • Plotly
  • Altair
  • Bokeh
  • Data Analysis
  • R
  • Machine Learning Math
  • Machin Learning
  • Deep Learning
  • Deep Learning Projects
  • NLP
  • Computer vision
  • Data science
  • Deep learning interview question
  • Machin Learning Interview question
Open In App
Next Article:
How to Create an Area Chart in Seaborn?
Next article icon

How to Create an Area Chart in Seaborn?

Last Updated : 19 Dec, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we are going to see how to create an area chart in seaborn using Python.

Area Charts are a great way to quickly and easily visualize things to show the average overtime on an area chart. Area charts are different from line graphs. Area charts are primarily used for the summation of quantitative data. however, the area between the line and the area chart is filled in with shading or color.

Area graph displays graphically quantitative data. It is based on the line chart. In both line graphs and area charts, data points are connected by line segment to show the values of a quantity at different points.

Example 1: Create Basic Area Chart in Seaborn

In this example, we are going to see how to create a basic area chart in seaborn.

Python3
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns  #set seaborn style sns.set_theme()  #define DataFrame data = {'period': [1, 2],                    'rohit': [10, 5],                    'vikey': [5, 19],                    }  df = pd.DataFrame(data)  #create area chart plt.stackplot(df.period, df.rohit, df.vikey,               labels=['rohit', 'vikey']) 

Output:

Example 2: Create Custom Area Chart in Seaborn

In this example, we are going to see how to create an area chart by defining different colors in color_map=[] in seaborn.

Python3
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns  # set seaborn style sns.set_theme()  data = {'period': [1, 2, 3, 4, 5, 6, 7, 8],                    'team_B': [15, 17, 17, 19, 22, 19, 19, 14],                    'team_C': [21, 18, 20, 16, 16, 15, 19, 22]}  # define DataFrame df = pd.DataFrame(data)  # define colors to use in chart color_map = ['orange', 'pink']  #create area chart plt.stackplot(df.period, df.team_B, df.team_C,               labels=['Team B', 'Team C'],               colors=color_map) 

Output:

Example 3: Create Multiple Area Chart in Seaborn.

In this example, we are going to see how we can add create multiple area charts in a single subplot by defining different data with its different color in color_map=[] in seaborn.

Python3
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns  # set seaborn style sns.set_theme()   # define DataFrame df = pd.DataFrame({'Class': [1, 2, 3, 4, 5, 6, 7, 8],                    'sec_A': [20, 12, 9, 14, 18, 20, 15, 22],                    'sec_B': [ 12, 5, 7, 7, 9, 9, 9, 4],                    'sec_C': [11, 8, 5, 9, 12, 10, 6, 6]})  # define colors to use in chart color_map = ['yellow', 'blue', 'black']  # create area chart plt.stackplot(df.Class, df.sec_A, df.sec_B, df.sec_C,               labels=['Sec A', 'Sec B', 'Sec C'],               colors=color_map) 

Output:


Next Article
How to Create an Area Chart in Seaborn?

S

skrg141
Improve
Article Tags :
  • Python
  • Python-Seaborn
Practice Tags :
  • python

Similar Reads

    How To Make An Area Chart In Excel
    An Area chart is like a line chart in which the area between the x-axis and the line is colored to show the volume. Data Trends, Comparison of Multiple data Series, Emphasis on cumulative Data, and Time-Based or Categorized data are some key features of the Area chart. In this article, we will see h
    5 min read
    How to create an Area Chart using CSS ?
    In this article, we will see how to create Area charts using CSS. There are many Libraries available, which can help us to build area charts, although, here, we will be using pure HTML and CSS to create an Area Chart. An Area Chart is a graphical representation of quantitative data where multiple da
    4 min read
    How to Create a Bar Chart in Excel?
    To learn how to create a Column and Bar chart in Excel, let's use a simple example of marks secured by some students in Science and Maths that we want to show in a chart format. Note that a column chart is one that presents our data in vertical columns. A bar graph is extremely similar in terms of t
    4 min read
    Power BI - How to Create a Stacked Area Chart
    A stacked area chart is formed by combining the line chart, with the shaded area under that line. This chart is generally, used when we want to see the trends, that which field is performing better, in a particular time frame. For example, considering the stock prices of different companies, in the
    3 min read
    Power BI - How to Create a Scatter Chart?
    A Scatter chart is a chart, representing data points, spread on a graph, to show the column values. It helps us analyze and summarise the data very efficiently. We can also add legends, bubble sizes, and animations to this chart. This graph is widely used because it can show better visualizations in
    4 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