Fun

Everything is spiraling out of control!

I saw this fun bit of R code in a tweet by user aschinchon. df <- data.frame(x=0, y=0) for (i in 2:500) { df[i,1] <- df[i-1,1]+((0.98)^i)*cos(i) df[i,2] <- df[i-1,2]+((0.98)^i)*sin(i) } ggplot2::ggplot(df, aes(x,y)) + geom_polygon()+ theme_void()#rstats pic.twitter.com/cgNjyk405f — Antonio S. Chinchón (@aschinchon) August 16, 2018 Let’s remix it to make a fun animation. We’ll zoom in and out and have the colors shift. Click for R code suppressPackageStartupMessages({ library(tidyverse) library(tweenr) library(gifski) library(viridis) }) df <- data.

Connected scatterplot

On Twitter Claus Wilke asks: Dear Lazyweb: Is there an accepted name for a plot showing a two-variable time series as a path in the x-y plane? #dataviz@Elijah_Meeks @albertocairo @lenkiefer @sharoz @dataandme pic.twitter.com/N8Edmf8qii — Claus Wilke (@ClausWilke) July 21, 2018 I call them connected scatterplots, and we’ve made a few here. See for example this post. But we can intensify things and make a plot like this: hey @ClausWilke why stop at a 2-d connected scatterplot* when you could go to 3-d

Pomological Plots

In the real world, when I give talks and use slides I am typically constrained in my aesthetic. Often I’m speaking at a work-related thing and we have a corporate template and color scheme. They serve us well and I’ve found restraint helps focus on the message. Usually I’m setting out to inform, so direct, repeatable and easy to follow are key. But I also like to explore new ideas and different themes on the side.

Rate Cloud

TIME FOR A FUN NEW MORTGAGE RATE CHART. This one: We’ll use R to plot a new visualization of mortgage rates. Let’s make it. Data As we did with our majestic mortgage rate plot post we’ll plot mortgage rates using the Freddie Mac Primary Mortgage Market Survey. We’ll get the mortgage rates data via the Saint Louis Federal Reserve’s FRED database. If you followed my post from back in April of last year you know what we can do if we combine FRED with the quantmod package.

Forecasting Game

LET’S PICK BACK UP where we left off and think about communicating forecast results. To help guide our thinking, let’s set up a little game. Basic setup Like last time we’re going to focus on a situation where a forecaster observes some information about the world and makes an announcement about a future binary outcome. A decision maker observes the forecaster’s announcement and takes a binary action. Then the outcome is realized and the forecaster receives a payoff.

Rock that dadbod plot!

Spring is nearly upon us, or at least we can hope. Let’s examine how housing activity typically rounds into shape as the weather warms up. We’ll make some fun plots with R. Seasonality in housing data Housing market activity in the United States is highly seasonal. Consider this animated plot. This plot shows U.S. new home sales. Often the data are presented seasonally adjusted, but this plot is for non seasonally adjusted data.

Majestic mortgage rate plot

COME AND MAKE A MAJESTIC MORTGAGE RATE PLOT WITH ME. We’ll use R to plot a few visualizations of mortgage rates. I recently gave a number of talks about the economic outlook and housing. One point I like to make is that mortgage rates are low. I’ve shown this through a variety of visualizations. But one of my favorites looks like this: Let’s make it. Data We’ll plot mortgage rates using the Freddie Mac Primary Mortgage Market Survey.

Bivariate tilegridmaps with R

I HAVE BEEN EXPERIMENTING WITH A NEW WAY TO VISUALIZE DATA, a bivariate tilegridmap. When I get around to rolling out my tidyPowerPoint workflow we’re going to want something other than bars and lines to fill it up. A graph like this might be a fun option. We’ll build one, but first, just let me show you one I tweeted earlier today: bivariate #tilegridmap map anyone? pic.twitter.com/y3G5XExzoN — Leonard Kiefer (@lenkiefer) October 11, 2017 In this post, let’s go over how to make this plot with R.

ggplot as it was meant to be

I’ve BEEN MESSING AROUND MORE WITH R and OFFICER and having too much fun for a Monday. I’m going to dive into some details later, but I’ll just leave a couple files here. See the attached PowerPoint .pptx file for all the charts. Here’s a gif version I started with: Then after I created the PowerPoint I started messing around with the drawing tools and made increasingly ill-advised edits. Making gradient shading is hard in R and ggplot2, but not in Office:

Mortgage Rate Kandinsky

THINGS ARE ABOUT TO GET A BIT MORE ABSTRACT IN THIS SPACE. Today we make some Kandinsky-style images with R. This summer I was fortunate to spend some time at the Pompidou Centre in Paris. The Pompidou Centre houses the largest collection of modern art in Europe. I really enjoyed their collection of abstract and minimalist paintings. Well, turns out we can make our own abstract-style art using a Kandinsky R package from Giora Simchoni.

Index starting points and dataviz

SO WE HAVE BEEN PLOTTING A LOT OF INDEX VALUES LATELY. It’s been great. But you have questions. Great questions. I got an interesting response to my house price dot chart over Twitter regarding the house price index we were plotting. User [@chrisschnabel](https://twitter.com/chrisschnabel) wondered how the choice of starting point influenced how the house price dot chart looked. @lenkiefer This is a great viz, but conclusions will be drawn based on the date of the index.

What's that on the horizon? An awesome dataviz!

This post is everything you want it’s everything you need it’s every viz inside of you that you wish you could see it’s all the right viz at exactly the right time but it means nothing to you and you don’t know why LET US MAKE SOME HORIZON CHARTS. What is a horizon chart you ask? That’s exactly what I was thinking earlier this weekend. Well, not exactly. I sort of knew what horizon charts were, but I couldn’t say exactly what they were good for.

Treemapify those pies!

TIME FOR ANOTHER DATAVIZ REMIX. Saw on Twitter that [@hrbrmstr](https://twitter.com/hrbrmstr) posted a remix of a Wall Street Journal visualization over at rud.is. The original WSJ article used pies of various size to compare recent store closings. As we usually do in this space, we’ll use R to create our plots. Let’s mix things up and go remix the remix. Pies But first let’s consider the original. I’m not going to copy the original from the WSJ (click the link above to check out the story), but I am going to make my own pie version.

Let's Pixelate America

LET’S PIXELATE AMERICA. This morning I happened across a fun blog post on how to generate Pixel maps with R via R weekly. The basic code is so easy, all you need is ggplot2 (which I get from the tidyverse). library(tidyverse) ## Warning: package 'tidyverse' was built under R version 3.5.1 ## -- Attaching packages -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- tidyverse 1.2.1 -- ## v ggplot2 3.0.0 v purrr 0.2.5 ## v tibble 1.4.2 v dplyr 0.

Mortgage rates after dark

TONIGHT WE VISUALIZE MORTGAGE RATES AFTER DARK. Last year I shared 10 amazing ways to visualize mortgage rates (and more ways and even more ways). In this post I have one more DATA VISUALIZATION (dataviz) for you. I was putting together a presentation using remark.js via the xaringan R package (see my discussion of how to do this in this post) and decided to try a dark theme. The code below, modifies our mortgage rate code to make this graph:

Experimenting with expanding axes

LET US EXPERIMENT A BIT WITH AXES. In this post I’m going to try out some data visualization ideas expanding on our earlier work with ticks marks (see post ticks out). We’re going to make the following plot and some variations with R. As before, we’ll use data we used in our mortgage rate post to explore weekly average mortgage rates in the United States based on Freddie Mac’s Primary Mortgage Market Survey.

House prices are highest in coastal metros

TODAY THE NATIONAL ASSOCIATION OF REALTORS (NAR) released (press release) data on metro area median sales prices of existing single-family homes (the U.S. Census and HUD report data on new home sales prices in a joint release). NAR makes the data available (Excel file). Let’s take a look at the data: ## Warning: Removed 1 rows containing missing values (position_stack). ## Warning: Removed 1 rows containing missing values (geom_text). ## Warning in grid.

Populous metros are heavy!

I WANT TO SHARE WITH YOU a little bit of code to make this whimsical data visualization: Make a simple map First we can construct a map of the lower 48 U.S. states and add a marker for each city. These data are available in the us.cities data that come with the maps package. library(tidyverse) library(maps) data(us.cities) # get us city data from the package maps # drop AK and HI to get the lower 48 states: us.