Data visualization
5. Data visualization#
Data visualization and design play important roles in finance. We are often looking at time series data, such as plots of stock returns. We are comparing different firms at the same point in time using cross-sectional data. We also follow a set of firms through time using panel data.
Some data work is exploratory, where you want to see what you have, look for outliers, mistakes, etc. Other graphics will make it into a final presentation or client report. Python can do all of this.
This section follows Chapter 7 of Python for Finance, 2e and discusses using matplotlib to create graphics in Python.
However, there are many, more modern plotting libraries available for Python, such as plotly
, seaborn
, bokeh
, and altair
. Some of these, like plotly and bokeh, let you build interactive graphics. We’ll look a little bit at plotly and seaborn.
We’ll focus on financial data and the basic building blocks of creating plots, but just be aware that these packages can do a lot more.
The Intro to Data Visualisation for Coding for Economists covers some basic design principles. His section Narrative Data Visualisation expands on these ideas. He discusses the “anatomy” of figures and how to choose the best plot for your data.
Another concise guide. Note the use of seaborn
.
If you really want to make nice charts and graphs, read those guides. Like with our data work, sketch what you want to show. Why are you making certain choices? Be deliberate.