Evan bio photo

Evan

Noticing Birds.

Email LinkedIn Public Key Github

The San Francisco skyline is full of cranes, the new city bird. Across the entire San Francisco Bay Area we’re in the midst of a building boom. We’re also in a housing crisis, as rents outstripping inflation.

A common rebuttal to the building boom is that our cities are full; we’re at capacity, and all these new people need to return to where they’re really from.

But, are our cities full? Nope, they’re not even at capacity.

In the mid 20th century, those that could leave cities for newly built suburbs on the edge of the metropolis. Population decline hit different cities at different times. Berkeley’s baby boom staved off population decline, while SF’s wild reputation as a seaport leads to a population decrease sooner.

Since the 2000s, people have been moving back to the city.

a graph of people leaving inner bay area cities

For those who moved to the city before the influx, it can feel like the city is ‘full’, but census data shows that most cities still have room to grow.

While San Francisco may have gained more people since it’s 1960’s peak, Oakland and Piedmont, have yet to catch up. Our cities are not full. Even small Walnut Creek as sustained almost 2x growth over the last 60 years.

We have more than enough room to grow.

library("tidyverse")
library("ggplot2")
library("ggthemes")
library("hrbrthemes")
library("reshape2")
library("readxl")

raw_census <-
  # Lets load the cenus data from the kind MTC people
  read_excel(
    "./2010-1850_California_Cities.xlsx",
    sheet = "1850-2010",
    col_types = c(
      "text",
      "text",
      "skip",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "numeric",
      "skip",
      "skip",
      "skip",
      "skip"
    ),
    col_names = c(
      "county",
      "city",
      "1850",
      "1860",
      "1870",
      "1880",
      "1890",
      "1900",
      "1910",
      "1920",
      "1930",
      "1940",
      "1950",
      "1960",
      "1970",
      "1980",
      "1990",
      "2000",
      "2010"),
    skip = 3
  ) 
cal_census <- raw_census %>% 
  # Aggregate summery rows lack a city. We don't need them, so away they go!
  filter(!is.na(city)) %>%
  # Right now, the census is a tidy cube; however, we need a tall table
  group_by(county, city) %>%
  # with each each cities population at the census a single row 
  melt(value.name = "population", na.rm=TRUE, variable.name = "year") %>%
  # And the year of the census as a number, not a factor
  mutate(year = as.numeric(as.character((year))))

# Now that we have our data loaded, and melted into the proper form, we need to process it.
# We need to index population from the peak population, and to count off the years since peak population.
# name, index, year
# berkeley, .8, -1
# berkeley,  0,  0
# berkeley, .9,  1

# Find when population peaked, and how many people lived in the city.
peak_population <-cal_census[cal_census$city != 'Oakley',] %>%
  group_by(city) %>%
  # We want to look at cities who lost population in durring white flight.
  filter(between(year, 1900, 1970)) %>%
  # That were old enough to have people after 1900
  filter(population >= 1) %>%
  # Get the census with the most people in the city
  filter(population == max(population)) %>%
  ungroup(city) %>%
  arrange(year) %>%
  rename(peak_year = year, peak_population = population)

graphing_census <- cal_census %>%
  # Join the data about peak population to the census
  inner_join(peak_population) %>%
  group_by(city) %>%
  # generate the growth index
  mutate(population_index = population / peak_population) %>%
  # and offset from peak (years to peak)
  mutate(ytp = year - peak_year) %>%
  ungroup(city) %>%
  # Which cities do we want to see? Three is plenty
  filter(city %in% c("Oakland", "San Francisco", "Richmond"))

p <- ggplot(graphing_census) +
  theme_tufte() +
  labs(
    x = "Year since peak 20th c population",
    y = "City population index",
    title = "Growth Rates of SF Bay Area Cities",
    color = "City",
    caption = "data from bayareacensus.ca.gov "
  )  +
  scale_color_fivethirtyeight() +
  geom_hline(aes(yintercept = 0.999999), color = "#DDDDDD") +
  geom_line(aes(ytp, population_index, color = city), stat = 'identity') +
  #scale_y_continuous(limits = c(0.75, 1.05), minor_breaks = NULL) +
  scale_x_continuous(
    limits = c(-10, 60),
    minor_breaks = NULL,
    breaks = c(-60,-50,-40,-30,-20,-10, 0, 10, 20, 30, 40, 50, 60)
  )
p

Download the R code