Financial visualization with violin plots

We have been exploring how best to incorporate violin plots into our financial visualizations. A violin plot is the combnation of a box plot with a rotated kernel density plot on either side. A great way to use this unique plot is as a replacement for a candlestick chart. One of the reasons traders prefer a candle to a line chart is that the former includes much more information than a line: it includes the open/high/low/close data as well.

However, reducing a single day to 4 data points can filter out a great deal of useful information that we might want to keep. Substituting a violin plot provides the answer. The following chart shows the daily violin chart for SPY. Each violin represents the distribution of the price over the course of the day. Just like a more familiar bar chart, each violin is colored depending on whether the daily close was higher than the open.

Each day includes a lot more information than a candle or bar chart. The thickest parts of each violin represent the prices where SPY spent the most time trading. Thinner areas show prices that were ephemeral.

Violin plot for SPY

Violin plot for SPY

This type of plotting does a great job highlighting changes in volatility regimes. Note the expansion in daily ranges towards the end of 2014 entering into this year.

There are a number of ways to produce a violin plot. We have found that Python’s Seaborn package produces very pleasing results.

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s