Visualizing Distribution
DR. MUNEENDRA OJHA
A S S O C I AT E P R O F E S S O R
D E PA R T M E N T O F I N F O R M AT I O N T E C H N O L O G Y
I N D I A N I N S T I T U T E O F I N F O R M AT I O N T E C H N O L O G Y A L L A H A B A D
HISTOGRAM
• The histogram is the most basic graph type for visualizing a distribution.
• It is a specific kind of bar chart that presents the tabulated frequency of data over
distinct intervals, called bins, that sum to the total distribution.
10:33 PM 2
HISTOGRAM
• Histograms divide the entire sample into intervals (also called “bins”).
The height of the bin shows the number of observations within it.
10:35 PM 3
HISTOGRAM
• Histograms can be layered together by using saturated colors (left) or
different encodings like bars and lines (right) to show how different
distributions compare.
10:36 PM 4
HISTOGRAM
• More data are pushed to the left is known
as right-skewed.
• More observations to the right is called left-
skewed.
• Two peaks are called bimodal and with
multiple peaks are called multimodal.
• Symmetric distributions are those with a
roughly equal number of observations on
either side of a central value
• Uniform distributions in which the
observations are roughly equally distributed
or another.
10:42 PM 5
• The Pareto chart shows
values for each group
Pareto chart
(usually in bars) and the
cumulative total as a line.
• Its key purpose is to let
the reader see both the
contribution of each
group and how those
contributions
accumulate toward the
whole.
10:46 PM 6
Understanding Percentiles
10:53 PM 7
Understanding Percentiles
• Percentiles show a value’s position in an ordered distribution.
• The 1st percentile represents values near the bottom of the distribution.
• The 99th percentile represents values near the top of the distribution.
• The 50th percentile is the median, which splits the distribution into two equal
halves.
• Percentiles remain meaningful regardless of population size.
• Because percentiles are population-independent, they can be compared
across groups such as countries or industries.
11:00 PM 8
PYRAMID CHART
• A type of diverging bar chart used to show population-based metrics like birth rates, mortality
rates, age, or overall population levels.
• Good for showing overall distribution
shape
• Easy to spot younger vs older
population structure
• Harder to compare exact totals across
groups
• May be confused with positive vs
negative bars
• Alternatives: paired bar chart, dot plot,
lollipop chart
11:07 PM 9
Visualizing Statistical Uncertainty
Uncertainty from Randomness Uncertainty from Unknowns
Statistical confidence in models & results. e.g. margin of error in Data is inaccurate, imprecise, or incomplete. e.g. self-reported
polling: ±4 percentage points. income in census surveys.
"Uncertainty confuses many people because they have the unreasonable expectation that science and statistics will unearth precise truths,
when all they can yield is imperfect estimates."
-- Alberto Cairo, How Charts Lie
Chart types for uncertainty:
Why authors skip uncertainty:
Error Bars
Fear of confusing viewers
Confidence Interval Chart
No access to uncertainty data
Gradient / Stripe Chart
Don't know how to calculate it
Fan Chart
Don't want data to seem questionable
Hand-drawn / Sketchy look
Error Bars
Error bars show uncertainty in data.
They indicate the possible range around a
value.
They are usually added to bar charts or
line charts.
They are not a separate chart by
themselves.
Their ends may show confidence interval,
standard error, percentile, or a fixed range.
11:29 PM 11
Confidence Interval
• A confidence interval shows the range within which • A narrow interval means more precise estimation.
the true value is likely to lie. • A wide interval means more uncertainty.
• It is used to express uncertainty in an estimate. • Lines or shaded areas around a central line can
• It usually has a lower limit and an upper limit. visualize ranges of uncertainty.
11:43 PM 12
GRADIENT CHART
• A gradient chart (also called a stripe plot) visualizes distributions or
uncertainty using a color gradient.
• basic technique is to plot the primary number of importance and add
a color gradient on one or both sides to visually demonstrate the
measure of uncertainty around that single point.
• The plot is named not necessarily after the shape of the graph but
after the use of the color gradient.
11:48 PM 13
11:45 PM 14
FAN CHARTS
• If the color or saturation of the shaded area between the confidence
interval lines changes based on the value, it is often called a fan
chart.
• Fan charts are like gradient plots for line charts, and they are great
for visualizing changes in uncertainty over time.
• The advantage here is that it signals to the reader how the estimates
become less certain the further they are from the central estimate.
11:51 PM 15
• Like the gradient chart, the fan chart shows distributions (in this case, standard
errors) around a central estimate.
11:45 PM 16
Box-and-Whisker Plot
• When you visualize the distribution of your data, you can show the
entire distribution or just specific points within it.
• The box-and-whisker plot (or boxplot), uses a box and line markers to
show specific percentile values within a distribution.
• You can also add markers to show outliers or other interesting data
points or values.
11:45 PM 17
The basic box-and-whisker plot
Most box-and-whisker plots have five major components:
• Minimum – Smallest value (excluding outliers)
• Q1 (First Quartile) – 25% of data lies below this
• Median (Q2) – Middle value (50th percentile)
• Q3 (Third Quartile) – 75% of data lies below this
• Maximum – Largest value (excluding outliers)
How to Interpret It
• Wide box → High variability
• Narrow box → Low variability
• Median off-center → Skewed data
• Long whisker on one side → Skewness in that
direction
• Many outliers → Data has extreme values
12:12 AM 18
• These charts show the distribution of earnings in thirteen industries either sorted alphabetically (left)
or by median value (right).
• The edges of the box show the 25th and 75th percentiles and the whiskers show the 10th and 90th
percentiles.
11:45 PM 19
Candlestick Chart
• While box-and-whisker plots visualize
uncertainty or a distribution, candlestick charts
visualize changes in the prices of stocks,
bonds, securities, and commodities over time.
• Bars and lines show opening and closing
prices and highs and lows in a day, plotted
along a horizontal axis that measures time.
12:19 AM 20
11:45 PM 21
VIOLIN CHART
• A violin chart (violin plot) shows the distribution of data along with its density (shape).
• It combines features of a box plot and a density plot.
• Key Components
• Violin Shape → Shows the data distribution (density)
◦ Wider section → More data points
◦ Narrow section → Fewer data points
• Central Line → Median (middle value)
• Inner Box (sometimes shown) → Quartiles (Q1, Q3)
12:26 AM 22
11:45 PM 23
RIDGELINE PLOT
• The ridgeline plot is a series of histograms or density plots shown for
different groups aligned along the same horizontal axis and
presented with a slight overlap along the vertical axis.
• In a basic sense, the ridgeline plot is like a small multiples histogram
or a horizon chart where the histograms are aligned in particular way.
12:36 AM 24
12:39 AM 25
11:45 PM 26
Thanks !
• Reference – Chapter 6, Better Data Visualizations A Guide for
Scholars, Researchers, and Wonks by Jonathan Schwabish,
Columbia University Press, 2021
27