TIME TO TRY OUT ANOTHER HOUSE PRICE VISUALIZATION.
In this post we’ll try out a new way to visualize recent house price trends with R.
Just this wekeend I saw a new package geofacet for organizing ggplot2 facets along a geographic grid. It allows use to construct a small multiple graph that roughly looks like the United States. (Thanks to @yoniceedee for recommending geofacet).
Let’s try it out using the same house price data we visualized recently. Details about the data are in that post, but we’ll be using the Freddie Mac House Price Index to once again visualize state house price trends.
Let’s get to it.
We’ll start this post with our data in hand. Just follow along here to get the data. We’ll begin with a data frame called
df.state that looks like so.
|Our data frame df.state|
|Source: Freddie Mac House Price Index|
The key variable we’ll need is
hpa which captures the 12-month percent change in the house price index. Conveniently, we already have a state identifier to use with
facet_geo (though we’ll have to rename it state).
Facet my geo
With our data in hand, it’s pretty easy to create our plot. Our data goes from 1975 to March 2017, so we’ll subset it to focus on more recent trends. We’ll plot 12-month percent changes in house prices (variable
hpa in our data) since 2000. We’ll also restrict our attention to March of each year (so we can end with the latest data in March 2017).
Pretty neat. I think I’ll be trying this more in the future.
It also works pretty great for an animation. Here’s an animated version of our plot: