Len Kiefer

Helping people understand the economy, housing and mortgage markets

Gradient shading with ggplot2

Over on Twitter Grant McDermott shares a neat ggplot2 trick: A shortcut I like to use is calling multiple geoms in an lapply() call, since this automatically generates a list. Works well for investigating plotting variations, e.g. ggplot(diamonds, aes(carat)) + lapply(c(50,200), function(b) geom_histogram(bins=b, alpha=0.3)) https://t.co/hf0vtvDkbk pic.twitter.com/jmmqlyJEKo — Grant McDermott (@grant_mcdermott) June 22, 2020 I applied this trick to create a gradient fill for a chart. Looks kind of like Kool-Aid.

The Coronavirus Recession

Coronavirus Recession Over on LinkedIn I posted a summary of recent economic talks I have been giving: The Coronavirus Recession. Read the whole things for analysis and lots of charts, but I leave off with three key questions: Recession was here, but is it already gone? Housing market indicators have rebounded, but will the recovery be sustained? After effects of shutdown and possible second wave to the pandemic remain as risks to the outlook, how big are these risks?

Presentation Quadfecta and Jobs Friday June 2020

Yesterday I completed the elusive presentation quadfecta. I did a talk on Zoom, Teams, WebEx and Skype. These communication apps are great, but after a few hours of maintaining “resting Zoom face” (you want to look interested as the camera is always rolling), I felt a bit exhausted. But it was totally worth it. The highlight for me was being able to join Jeffrey Shaffer, Steve Wexler, Amanda Makulec, and Andy Cotgreave for Chart Chat.

State unemployment rate dataviz

A couple years ago I posted R code for a remix of a remix of a US state unemployment rate chart. Post Working on a workout. Some of the images were lost in a blog transition. We’ll update below. Here’s an updated version: And another remix focusing just on April 2020 (latest data). R code ###################### ## Load Libraries ## ###################### library(data.table) library(quantmod) library(tidyverse) library(geofacet) # Download data big file ur.

Tornado Charts

Earlier this week, I made a boss chart: https://t.co/6wf40jtqHI pic.twitter.com/xlv3Uzpiv0 — 📈 Len Kiefer 📊 (@lenkiefer) May 12, 2020 While listening to Chart Chat I heard Jeffrey Shaffer, Steve Wexler, Amanda Makulec, and Andy Cotgreave discuss tornado charts. I decided it might be a good idea to make one. Because I’m not sure I can trust with the awesome power inherent in these charts I won’t post R code here.

Mortgage rates hit a record low

This week the Freddie Mac Primary Mortgage Market Survey reported a record low for the U.S. weekly average 30-year mortgage rate. First some charts, then below I post R code. R code Load libraries library(fredr) library(tidyverse) library(patchwork) library(cowplot) library(gganimate) library(lubridate) # updated You’ll need a custom color scale (see below for code). R code to wrangle data data preparation code source(paste0(mydir,"len_color_scales.R")) #custom color scale code copied below fredr_set_key("YOURKEY") df <- fredr(series_id = "MORTGAGE30US", observation_start = as.

Last Summer This Spring

Earlier this week I gave a talk and used this picture to compare myself last summer to this spring. Some key differences. Last summer I was: clean shaven provoking bears This spring I am: sporting a quarantine beard dealing with sassy autofill Despite what autofill was suggesting I think there’s some reason for optimism, though no doubt recent weeks have been tough. Last summer, when I took the photo with the bears, I was up in New York City.

The US economy in lockdown

The past week we started to get monthly economic data from March, after the U.S. economy shut down to battle the COVID-19 pandemic. The results were sobering. We already knew the US labor market was in a tough spot. But last week we got data for housing starts and retail sales which showed the size of the economic contraction. Below are some charts I posted to Twitter last week.

Updated Favorite Data Visualizations

I’ve decided to create a post where I can regularly update some favorite data visualizations. Where I’ve previously discussed the data or shared code I will provide a link. Often I’ll update the charts and post them on Twitter soon after the data is released. I won’t be updating these that quickly, but I’ll do my best to keep up. As I update some more charts I may add to the list.