FirstHack Learn
Log in Sign up free
Lessons in this course 0/6 All courses Python for Data Analysis

AI & DS

Progress0 / 6 lessons
  1. 1. NumPy arrays and why they beat lists
  2. 2. pandas Series and DataFrame
  3. 3. Loading, cleaning and handling missing data honestly
  4. 4. Filtering, groupby and merge
  5. 5. Simple statistics and what they hide
  6. 6. Plotting basics, and how not to mislead with a chart

Courses › Python for Data Analysis

Plotting basics, and how not to mislead with a chart

Four chart types that cover most needs, and the axis tricks that turn a chart into a lie.

12 min read · Lesson 6 of 6 · Pro

The four charts you actually need

Chart Answers
Bar how do categories compare?
Line how does something change over time?
Histogram how is one numeric column distributed?
Scatter do two numeric columns move together?

Pick by the question, not by which one looks nicer.

Setup

Python 3
import pandas as pd
import matplotlib
matplotlib.use("Agg")          # write to a file, no display needed
import matplotlib.pyplot as plt

df = pd.DataFrame({
    "branch": ["CSE", "ECE", "MECH", "CIVIL"],
    "avg":    [78, 71, 65, 68],
    "count":  [120, 95, 60, 55],
})
The rest of this lesson is Pro

The free lessons of Python for Data Analysis finish what they start — read those first if you have not. This one goes further, and it is part of the paid half.

A pass opens the paid lessons of every course, the mock test papers and the company-wise series. It ends on its own date; nothing renews by itself.

Get a pass — from ₹29 for 7 days

Already bought one? Log in.