Reading Financial Charts in Python II: Choosing Distribution Plots

Two assets can have the same average return and completely different lives.
One has a quiet, boring Tuesday every Tuesday. The other has the same average, delivered as long calm stretches and the occasional disaster.
The average cannot tell them apart. A distribution plot can.
In Part 1 we looked at how assets move together. Here we look at how each one moves by itself. We take one dataset and ask four questions, and for each question we pick the chart that answers it, then check what that chart is hiding.
This is not a catalogue of every plot seaborn can draw. It is a decision guide: which chart for which question, and where each one quietly misleads.

The Setup: Five Assets, One Table
In contrast to the first post, we want assets with very different personalities, so we pick five.
That is broad US equities, Nasdaq-100, gold, long-dated US Treasuries and Bitcoin.
There is a data trap hiding here, and it is the kind that does not raise an error. Bitcoin trades every day, including weekends. The others only trade on exchange days. So the table has rows where four columns are empty.
After dropna(), a Monday row for Bitcoin is compared with the previous Friday, exactly like the stocks. The calendars now agree. The cost is that we throw away Bitcoin's weekend movements, which is fine for this post but worth knowing.
First, let's see what the "average" view looks like.
Skew says whether the distribution leans towards big gains or big losses. For example a value of -0.2 means the distribution slighly skews to the left, in our language slightly towards lower returns. While a value of 0.16 skews slightly to the right towards unusally high returns.
Excess kurtosis says how heavy the tails are compared with a normal distribution, where 0 means "about as heavy as normal". In this case a value close to 0 means unusually large movements are broadly similar to a normal distribution. A high positive number instead says that the data has more extreme observations (up or down) than a normal distribution would indicate, while a negative number means less extreme observations.
Four numbers per asset are a good start. Although useful, they are still just summaries, and summaries throw things away. Let's look at the data itself.
For the plotting code we also want the table in long format, one row per observation:
Question 1: Where Do the Observations Live?
The classic answer is a boxplot.
The box holds the middle 50% of days. The line is the median. The whiskers extend according to a fixed rule, since we use seaborn's default range, this would be 1.5 times the inerquartile range. Points beyond the whiskers are "outliers". In our example

We turned the outlier markers off (showfliers=False) and drew every observation ourselves with stripplot. That way, the box is the summary and the dots are the evidence.
Two things a boxplot hides, which the dots expose:
How many points sit beyond the whiskers. A boxplot shows them as a handful of circles. With heavy tails you may have dozens.
Whether the data is lumpy. A box looks the same whether the middle is a smooth hill or two separate clusters.
Also note: a point beyond the whisker is not a data error. In financial returns it is often the most interesting part.
Question 2: What Shape Is It?
To see the shape, add a smoothed estimate of the density. Two common ways are a violin plot and a KDE plot.
A violin is a mirrored density curve. Wide means "many observations around this value". cut=0 stops the curve from extending past the actual data range, which would otherwise suggest returns that never happened. In our example

A KDE plot is the same idea, drawn as a plain curve:
In our example we end up with

But, KDE is not universally useful. It places a small bump at every observation and adds them up. The width of those bumps, the bandwidth, decides what you see.
Too small, and random wiggles look like structure. Too large, and real features vanish into a single blob. In our example we get

This matters because it is tempting to see two humps in a density and announce "two market regimes". The honest statement is narrower: under these settings, the estimated density has two humps. To claim regimes, you need to show when each hump occurs and that it persists. A density discards time entirely.
Two more notes on reading these plots. The vertical axis is density, not probability. The height at a point is not "the chance of that exact return". Areas under the curve are probabilities.
And with common_norm=False, each asset's curve integrates to 1 separately. That is what you want for comparing shapes.
Question 3: How Often Do We Cross a Line?
Here is a question densities answer badly: how often is a day worse than -3%?
You can eyeball it from the left tail of a KDE, but the answer depends on the bandwidth. A better tool needs no bins and no smoothing: the ECDF.
The empirical cumulative distribution function simply answers: "what fraction of days were at or below this value?"
Read it by going up from -3% on the x-axis until you hit a curve. The height there is the fraction of days with a return of -3% or worse. In our example

To no one's surprise, Bitcoin is the most volatile here. It has a good deal more days under -3%, but it also has a lot more days with much higher returns. That is also a one-liner in numbers:
This gives one number per asset, telling us the same proportion with no smoothing and no tuning. An ECDF is the plot I reach for when a question starts with "how often".
A subtle trap: conditioning on the tail.
Suppose we zoom into just the worst 5% of Bitcoin days and draw an ECDF of those.
The two numbers answer different questions. The first is a probability inside the selected tail. The second is across all days.
If 20% of the tail days were at least -10%, that is about 1% of all days, because you multiply by the 5% you selected. Quoting the first number as though it described "any day" overstates the risk by a factor of twenty.
The zoomed plot is not wrong. It is answering a more specific question, and the axis does not tell you that.
Question 4: Is the Normal Distribution a Fair Assumption?
A lot of standard finance maths quietly assumes returns are normally distributed. A QQ plot tests that assumption visually.
It plots observed quantiles against the quantiles you would expect from a normal distribution. If the data is normal, the points sit on a straight line. Where they curl away, the data differs from normal.
One detail is essential: standardise first. Bitcoin's daily moves are simply bigger than gold's, and we do not want the plot to measure "bigger". We want it to measure "differently shaped".
Here, probplot draws the points and a reference line. Read the tails: if the left end bends downward below the line, big losses are more extreme than a normal distribution predicts. If the right end bends upward above it, so are big gains. In our example

Because we standardised, the five panels are comparable. By this we mean that we centered it by subtracting the mean and then dividing by the standard diviation. A bend means a departure from each asset's own fitted normal, regardless of scale.
That is also why you should not conclude "Bitcoin is more non-normal because it has a +20% day". A +20% day is large in absolute terms, but Bitcoin's standard deviation is also large. The QQ plot controls for that. Departure from the line is the evidence.
One more caveat. A QQ plot diagnoses an assumption. It tells you the normal model is a poor description of the tails. It does not tell you which model to use instead.
Bringing It Together: The Raincloud
We now have a handful of views, each good at one thing:
View | Good at | Hides |
Boxplot | Centre and spread, quick comparison | Shape, number of extremes |
Strip / beeswarm | Every observation | Summary, crowds quickly |
Violin / KDE | Shape | Bandwidth choice, time |
ECDF | "How often past X?" | Shape is harder to read |
QQ plot | Fit to a reference distribution | Which model to use instead |
A raincloud plot layers the first three on one axis: the density as a cloud, the box as the summary, and the points as the rain.
This is the simple version. A purist raincloud uses a half-violin with the points offset to one side, which keeps the layers from overlapping. The version above is easier to write and a reasonable start. In our example

Notice long.sample(1500, ...). With thousands of points, the rain becomes a black smear. Sampling for the strip layer only, while the density and box use the full data, keeps the plot legible without lying about the summary.
More layers also need more explanation. If a reader cannot tell what each layer contributes, you have added decoration, not information. If we add the ptitprince package we get a nicer looking version

A Quick Detour: Rolling Windows Are Not Independent
A common variation is to plot the distribution of a rolling metric, such as a 63-day rolling Sharpe ratio, instead of daily returns.
This is a perfectly valid picture, but it has a catch. Neighbouring windows share 62 out of 63 days. So thousands of rolling values are not thousands of independent experiments. They are the same few months viewed repeatedly with a sliding frame. In our example

The violin can tell you how this metric behaved historically. It cannot tell you how confident you should be, because the effective number of independent observations is far smaller than the number of points.
Also, this calculation does not subtract a risk-free return, so it is not quite the textbook Sharpe ratio. It is a mean-over-volatility measure, which is fine as long as you call it that.
When NOT to Use These
Do not use a density for small samples. A KDE of fifty points will happily draw a smooth curve through noise.
Do not use a boxplot alone. It looks the same for very different shapes.
Do not read probabilities off a density's height. Use an ECDF or integrate the area.
Do not trust a QQ plot with very few points. The tails of a small sample bend by chance.
Do not forget time. Every chart in this post ignores when things happened. A distribution of returns across 2018 to 2025 averages calm years and crisis years into one shape. If timing matters, you need a different tool.
Wrapping Up
We asked four questions and picked four answers:
Where do the observations live? Box plus raw points.
What shape is it? Violin or KDE, with the bandwidth varied on purpose.
How often do we cross a threshold? ECDF, mindful of what you conditioned on.
Is normal a fair assumption? QQ plot, standardised first.
The pattern across both posts is the same. A chart is a statement about your data, made with choices you may not have noticed: the dataset, the scaling, the smoothing, the threshold. Skilled use of a chart is mostly about knowing which of those choices produced the picture in front of you.
The obvious next step is the question these plots cannot answer: when do the bad days happen, and how long does it take before one arrives? That moves us from distributions to survival analysis and volatility over time, which deserves its own post.



Comments