OPTION 2: (Challenge) Recreate

Libraries

## library(tidyverse)
## library(ggplot2)
## library(colorspace)
## library(ggthemes)
## library(gridExtra)
## library(grid)

The Data

useThanks<-read.csv("https://raw.githubusercontent.com/kitadasmalley/FA2020_DataViz/main/data/useThanks.csv", header=TRUE)

glimpse(useThanks)
## Rows: 1,058
## Columns: 83
## $ id                  <dbl> 4337954960, 4337951949, 4337935621, 4337933040, 43~
## $ celebrate           <chr> "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "~
## $ main                <chr> "Turkey", "Turkey", "Turkey", "Turkey", "Tofurkey"~
## $ cooked              <chr> "Baked", "Baked", "Roasted", "Baked", "Baked", "Ro~
## $ stuffing            <chr> "Bread-based", "Bread-based", "Rice-based", "Bread~
## $ cranberry           <chr> "None", "Other (please specify)", "Homemade", "Hom~
## $ gravy               <chr> "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "~
## $ brussel.sprouts     <chr> "", "", "Brussel sprouts", "Brussel sprouts", "Bru~
## $ carrots             <chr> "Carrots", "", "Carrots", "", "", "Carrots", "", "~
## $ cauliflower         <chr> "", "", "Cauliflower", "", "", "Cauliflower", "", ~
## $ corn                <chr> "", "Corn", "Corn", "", "", "Corn", "", "", "Corn"~
## $ cornbread           <chr> "", "", "Cornbread", "Cornbread", "Cornbread", "Co~
## $ fruit.salad         <chr> "", "", "", "", "", "Fruit salad", "Fruit salad", ~
## $ green.beans         <chr> "Green beans/green bean casserole", "Green beans/g~
## $ mac.n.cheese        <chr> "Macaroni and cheese", "Macaroni and cheese", "", ~
## $ mashed.potatoes     <chr> "Mashed potatoes", "Mashed potatoes", "Mashed pota~
## $ rolls               <chr> "", "Rolls/biscuits", "Rolls/biscuits", "Rolls/bis~
## $ squash              <chr> "", "", "", "", "Squash", "Squash", "", "", "Squas~
## $ salad               <chr> "", "Vegetable salad", "Vegetable salad", "Vegetab~
## $ yams.sweet.potato   <chr> "Yams/sweet potato casserole", "Yams/sweet potato ~
## $ apple.pie           <chr> "Apple", "Apple", "Apple", "", "Apple", "", "Apple~
## $ buttermilk.pie      <chr> "", "", "", "", "", "", "", "", "Buttermilk", "But~
## $ cherry.pie          <chr> "", "", "Cherry", "", "", "", "", "", "", "", "", ~
## $ chocolate.pie       <chr> "", "Chocolate", "", "", "", "", "", "Chocolate", ~
## $ coconut.pie         <chr> "", "", "", "", "", "", "", "", "", "", "", "", ""~
## $ keylime.pie         <chr> "", "", "", "", "", "", "", "", "", "", "", "", ""~
## $ peach.pie           <chr> "", "", "Peach", "", "", "", "", "", "", "", "", "~
## $ pecan.pie           <chr> "", "", "Pecan", "Pecan", "", "", "", "", "", "", ~
## $ pumpkin.pie         <chr> "", "Pumpkin", "Pumpkin", "Pumpkin", "Pumpkin", ""~
## $ sweet.potato.pie    <chr> "", "", "Sweet Potato", "", "", "Sweet Potato", ""~
## $ apple.cobbler       <chr> "", "", "", "", "", "", "", "", "", "", "", "", ""~
## $ blondies            <chr> "", "", "", "", "", "", "", "", "", "", "", "", ""~
## $ brownies            <chr> "", "", "Brownies", "", "", "", "", "", "", "", ""~
## $ carrot.cake         <chr> "", "", "Carrot cake", "", "", "", "", "", "", "",~
## $ cheesecake          <chr> "Cheesecake", "Cheesecake", "", "", "", "Cheesecak~
## $ cookies             <chr> "Cookies", "Cookies", "Cookies", "", "", "", "Cook~
## $ fudge               <chr> "", "", "Fudge", "", "", "", "", "", "", "", "", "~
## $ ice.cream           <chr> "Ice cream", "", "Ice cream", "", "", "", "", "", ~
## $ peach.cobbler       <chr> "", "", "", "", "", "", "", "", "", "", "", "", "P~
## $ pray                <chr> "Yes", "Yes", "Yes", "No", "No", "Yes", "No", "No"~
## $ friendsgiving       <chr> "No", "No", "Yes", "No", "No", "Yes", "No", "Yes",~
## $ black.friday        <chr> "No", "Yes", "Yes", "No", "No", "Yes", "Yes", "Yes~
## $ area.live           <chr> "Suburban", "Rural", "Suburban", "Urban", "Urban",~
## $ age                 <chr> "18 - 29", "18 - 29", "18 - 29", "30 - 44", "30 - ~
## $ gender              <chr> "Male", "Female", "Male", "Male", "Male", "Male", ~
## $ income              <chr> "$75,000 to $99,999", "$50,000 to $74,999", "$0 to~
## $ DivName             <chr> "Middle Atlantic", "East South Central", "Mountain~
## $ celebrate01         <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,~
## $ gravy01             <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, NA, 0, 1, 1, 1, 1, 1~
## $ friendsgiving01     <int> 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, NA, 0, 0, 1, 0, 1, 1~
## $ black.friday01      <int> 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, NA, 0, 0, 1, 0, 0, 1~
## $ brussel.sprouts01   <int> 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,~
## $ carrots01           <int> 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,~
## $ cauliflower01       <int> 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,~
## $ corn01              <int> 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1,~
## $ cornbread01         <int> 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,~
## $ fruit.salad01       <int> 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,~
## $ green.beans01       <int> 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1,~
## $ mac.n.cheese01      <int> 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,~
## $ mashed.potatoes01   <int> 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1,~
## $ rolls01             <int> 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1,~
## $ squash01            <int> 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1,~
## $ salad01             <int> 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,~
## $ yams.sweet.potato01 <int> 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1,~
## $ apple.pie01         <int> 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0,~
## $ buttermilk.pie01    <int> 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,~
## $ cherry.pie01        <int> 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1,~
## $ chocolate.pie01     <int> 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0,~
## $ coconut.pie01       <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,~
## $ keylime.pie01       <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,~
## $ peach.pie01         <int> 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,~
## $ pecan.pie01         <int> 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1,~
## $ pumpkin.pie01       <int> 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0,~
## $ sweet.potato.pie01  <int> 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0,~
## $ apple.cobbler01     <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,~
## $ blondies01          <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,~
## $ brownies01          <int> 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,~
## $ carrot.cake01       <int> 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,~
## $ cheesecake01        <int> 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,~
## $ cookies01           <int> 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0,~
## $ fudge01             <int> 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,~
## $ ice.cream01         <int> 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,~
## $ peach.cobbler01     <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,~

Data Wrangling

Group_by and Summarise

Find the total number of households who serve each of the menu items, by region

t1 <- useThanks %>% 
  filter(celebrate == "Yes") %>%
  group_by(DivName) %>%
  summarize(Salad = sum(salad01), 
            Green_Beans = sum(green.beans01), 
            Rolls = sum(rolls01),
            Squash = sum(squash01), 
            Mac_and_Cheese = sum(mac.n.cheese01), 
            CornBread = sum(cornbread01),
            
            Apple = sum(apple.pie01),
            ButterMilk = sum(buttermilk.pie01),
            Cherry = sum(cherry.pie01),
            Chocolate = sum(chocolate.pie01),
            Coconut = sum(coconut.pie01),
            Peach = sum(peach.pie01),
            Pecan= sum(pecan.pie01), 
            Pumpkin = sum(pumpkin.pie01), 
            SweetPotatos = sum(sweet.potato.pie01))

head(t1, n=3)
## # A tibble: 3 x 16
##   DivName          Salad Green_Beans Rolls Squash Mac_and_Cheese CornBread Apple
##   <chr>            <int>       <int> <int>  <int>          <int>     <int> <int>
## 1 ""                  11          18    22      6              6         7    10
## 2 "East North Cen~    26         103   123     15             21        23    75
## 3 "East South Cen~     8          49    49     12             21        16    19
## # ... with 8 more variables: ButterMilk <int>, Cherry <int>, Chocolate <int>,
## #   Coconut <int>, Peach <int>, Pecan <int>, Pumpkin <int>, SweetPotatos <int>

Find the total number of households in each region

t2<- useThanks %>% 
  group_by(DivName) %>%
    filter(celebrate == "Yes") %>%
    count(DivName)

head(t2, n=3)
## # A tibble: 3 x 2
## # Groups:   DivName [3]
##   DivName                  n
##   <chr>                <int>
## 1 ""                      49
## 2 "East North Central"   145
## 3 "East South Central"    56

Drop rows and join data

t1<- t1[-1, ]
t2 <- t2[-1, ]


thanks <- t1 %>% full_join(t2)
## Joining, by = "DivName"
head(thanks, n=3)
## # A tibble: 3 x 17
##   DivName          Salad Green_Beans Rolls Squash Mac_and_Cheese CornBread Apple
##   <chr>            <int>       <int> <int>  <int>          <int>     <int> <int>
## 1 East North Cent~    26         103   123     15             21        23    75
## 2 East South Cent~     8          49    49     12             21        16    19
## 3 Middle Atlantic     33          92   106     44             20        33   106
## # ... with 9 more variables: ButterMilk <int>, Cherry <int>, Chocolate <int>,
## #   Coconut <int>, Peach <int>, Pecan <int>, Pumpkin <int>, SweetPotatos <int>,
## #   n <int>
Census Statistics

In order to assess what dishes are served “disproportionately” by region, we first need to understand national trends. Thus, we must calculate national values as weighted averages by population distribution in regions. This data comes from https://www.hcup-us.ahrq.gov/figures/nis_figure1_2018.jsp

popDiv<-data.frame(DivName=c("East North Central",
                             "East South Central", 
                             "Middle Atlantic", 
                             "Mountain", 
                             "New England", 
                             "Pacific", 
                             "South Atlantic", 
                             "West North Central", 
                             "West South Central"), 
                   pop=c(46798649, 
                         18931477,
                         41601787,
                         23811346,
                         14757573,
                         52833604,
                         63991523,
                         21179519,
                         39500457))%>%
  mutate(popProp=pop/323405935)

head(popDiv, n=3)
##              DivName      pop    popProp
## 1 East North Central 46798649 0.14470560
## 2 East South Central 18931477 0.05853782
## 3    Middle Atlantic 41601787 0.12863644
Difference

Take the differences between the region level proportions and the national proportions

differences <- proportions %>%
    mutate(difference_Salad = Salad_all- propSalad,
         difference_GreenBean = GreenBeans_all- propGreenBeans,
         difference_Rolls = Rolls_all - propRolls,
         difference_Squash = Squash_all - propSquash, 
         difference_Mac = Mac_all - propMac, 
         difference_CornBread = CornBread_all - propCornBread,
         
         difference_Apple = Apple_all- propApple,
         difference_Cherry=  Cherry_all-propCherry,
         difference_ButterMilk= ButterMilk_all- propButterMilk,
         difference_Chocolate= Chocolate_all- propChocolate,
         difference_Coconut= Coconut_all-propCoconut,
         difference_Pecan= Pecan_all -propPecan,
         difference_Peach= Peach_all -propPeach,
         difference_Pumpkin= Pumpkin_all-propPumpkin,
         difference_SweetPotatos= SweetPotatos_all-propSweetPotatos)%>%
  
    select(DivName, "difference_Salad", "difference_GreenBean", "difference_Rolls", "difference_Squash","difference_Mac", "difference_CornBread", "difference_Apple", "difference_Cherry", "difference_ButterMilk", "difference_Chocolate", "difference_Coconut", "difference_Peach", "difference_Pecan", "difference_Pumpkin", "difference_SweetPotatos")


head(differences, n=3)
## # A tibble: 3 x 16
##   DivName            difference_Salad difference_Gree~ difference_Rolls difference_Squa~
##   <chr>                         <dbl>            <dbl>            <dbl>            <dbl>
## 1 East North Central           0.0334          0.00716          -0.0491           0.0738
## 2 East South Central           0.0698         -0.157            -0.0759          -0.0371
## 3 Middle Atlantic             -0.0149          0.0830            0.0681          -0.126 
## # ... with 11 more variables: difference_Mac <dbl>, difference_CornBread <dbl>,
## #   difference_Apple <dbl>, difference_Cherry <dbl>,
## #   difference_ButterMilk <dbl>, difference_Chocolate <dbl>,
## #   difference_Coconut <dbl>, difference_Peach <dbl>, difference_Pecan <dbl>,
## #   difference_Pumpkin <dbl>, difference_SweetPotatos <dbl>
Summarise to Region/Division Favorites
fav <- bind_cols(DivName = c("East North Central Division",
                                      "East South Central Division",
                                      "Middle Atlantic Division",
                                      "Mountain Division",
                                      "New England Division",
                                      "Pacific Division",
                                      "South Atlantic Division",
                                      "West North Central Division",
                                      "West South Central Division"),
                       
                           favSide = c("Rolls / Biscuits", 
                                      "Mac & Cheese",
                                      "Squash",
                                      "Salad",
                                      "Squash",
                                      "Salad",
                                      "Mac & Cheese",
                                      "Green Beans / Casserole",
                                      "Cornbread"),
                  
                           favFlavor = c("Apple", 
                                      "ButterMilk", 
                                      "Cherry", 
                                      "Chocolate", 
                                      "Coconut",  
                                      "Pecan", 
                                      "Peach", 
                                      "Pumpkin", 
                                      "SweetPotato"))
                          
head(fav, n=3)
## # A tibble: 3 x 3
##   DivName                     favSide          favFlavor 
##   <chr>                       <chr>            <chr>     
## 1 East North Central Division Rolls / Biscuits Apple     
## 2 East South Central Division Mac & Cheese     ButterMilk
## 3 Middle Atlantic Division    Squash           Cherry

Import Map Package

#install.packages("usmap")
library(usmap)

states <- usmap::us_map()
head(states, n=3)
##         x        y order  hole piece group fips abbr    full
## 1 1091779 -1380695     1 FALSE     1  01.1   01   AL Alabama
## 2 1091268 -1376372     2 FALSE     1  01.1   01   AL Alabama
## 3 1091140 -1362998     3 FALSE     1  01.1   01   AL Alabama

Join to Your Data

fips<-read.csv("https://raw.githubusercontent.com/kitadasmalley/FA2020_DataViz/main/data/stateFIPS.csv", 
               header=TRUE)
geoPie<-fips%>%
  left_join(fav)
## Joining, by = "DivName"
head(geoPie, n=3)
##         ï..Name State Region       RegionName Division              DivName
## 1   Connecticut     9      1 Northeast Region        1 New England Division
## 2         Maine    23      1 Northeast Region        1 New England Division
## 3 Massachusetts    25      1 Northeast Region        1 New England Division
##   favSide favFlavor
## 1  Squash   Coconut
## 2  Squash   Coconut
## 3  Squash   Coconut
foodStates<-states %>%
  mutate..Name=full)%>%
    left_join(geoPie)
## Joining, by = "ï..Name"
head(foodStates, n=3)
##         x        y order  hole piece group fips abbr    full ï..Name State
## 1 1091779 -1380695     1 FALSE     1  01.1   01   AL Alabama Alabama     1
## 2 1091268 -1376372     2 FALSE     1  01.1   01   AL Alabama Alabama     1
## 3 1091140 -1362998     3 FALSE     1  01.1   01   AL Alabama Alabama     1
##   Region   RegionName Division                     DivName      favSide
## 1      3 South Region        6 East South Central Division Mac & Cheese
## 2      3 South Region        6 East South Central Division Mac & Cheese
## 3      3 South Region        6 East South Central Division Mac & Cheese
##    favFlavor
## 1 ButterMilk
## 2 ButterMilk
## 3 ButterMilk

Make your first attempt at creating a graphic

ggplot(foodStates, aes(x= x, y= y, group = group, fill = favSide)) +
  geom_polygon() 

Color palette

I will create my own color palette based on the fall season, we are using color in a qualitative variable (Side name)

ggplot(foodStates, aes(x = x, y = y, group = group, fill = favSide)) +
  geom_polygon() +
  scale_fill_manual(values=c("#f8961e","#2d6a4f", "#ffc300","#15616d","#90C685", "#B2612A"))

Brainstorming/Planning

● What polishing needs to be done?

Adding labels with the labs() function:

  • Titles
  • Subtitles
  • Caption
  • Remove legend in the right side
  • Remove axis names

Annotate

  • Create labels for the Side/ Pie Flavor names

Add a footer -Grid Extra package

Control the display of all non-data elements of the plot:

If necessary, use library ggthemes and

theme() to tweak individual settings: - element_text= size, face, position
- axis.ticks
- plot.title
- plot.subtitle
- plot.caption
- panel.background= element_rect - plot.background = element_rect
- legend.position = “none”

● What do you find confusing?

  • The limits of the colored area
  • The scales

● What do you find distracting?

  • The background color
  • The grid panels
  • The axis’ scale
  • the legend

Update your plot

 ## The Labels

thanks <- data.frame(x = c(-2e+06,0.15e+06,1.25e+06,2.25e+06,2.2e+06,0.75e+06),
                 y = c(0.80e+06,0.8e+06,0.65e+06,0.90e+06,-1.3e+06,-2e+06),
                 text = c("SALAD",
                          "GREEN BEANS/\nCASSEROLE",
                          "ROLLS/\nBISCUITS",
                          "SQUASH",
                          "MAC &\nCHEESE",
                          "CORNBREAD"))

map <- ggplot(foodStates, aes(x = x, y = y, group = group, fill = favSide)) +
  
  geom_polygon(color = "grey60")+

  scale_fill_manual(values=c("#f8961e","#2d6a4f", "#ffc300","#15616d","#90C685", "#B2612A"))+
  
  
  labs( x= "",
        y= "",
        title = "Thanksgiving Sides in America",
        subtitle = "Where Are the Tamales?",
        )+
  
  
  annotate("text",
           x = thanks$x, 
           y = thanks$y, 
           label= thanks$text, fontface= "bold", size= 3.3,
           color= c( "#90C685", "#2d6a4f", "#15616d", "#B2612A", "#ffc300", "#f8961e"))+

  
  theme_fivethirtyeight()+

  theme(  axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks = element_blank(),
          
          legend.position = "none",
          
          panel.border = element_blank(),
          panel.grid = element_blank(),
          panel.grid.major = element_blank(),
          panel.background = element_rect(fill="#F0F0F0",
                                          color="#F0F0F0"), 
          
          plot.background = element_rect(fill="#F0F0F0", color="#F0F0F0"),
          plot.title = element_text(face = "bold", size = "15"),
          plot.subtitle = element_text(color = "#6E6E6E", size= "14", 
                                       margin=margin(0,0,5,0)),
          plot.caption = element_text(size = "12", color = "white", hjust = "1")
          
          
          ) 
map

Final polished plot

map <- ggplot(foodStates, aes(x = x, y = y, group = group, fill = favSide)) +
  
  geom_polygon(color = "grey55")+
  
  geom_hline(yintercept = 1.5e+06,
             color = "grey60", size= 0.3)+

  scale_fill_manual(values=c("#f8961e","#2d6a4f", "#ffc300","#15616d","#90C685", "#B2612A"))+
  
   labs( x= "",
        y= "",
        title = "Thanksgiving Sides in America",
        subtitle = "Where Are the Tamales?"
        )+
  
  
  annotate("text",
           x = thanks$x, 
           y = thanks$y, 
           label= thanks$text, fontface= "bold", size= 3.3,
           color= c( "#90C685", "#2d6a4f", "#15616d", "#B2612A", "#ffc300", "#f8961e"))+

  
  theme_fivethirtyeight()+

  theme(  axis.title = element_blank(),
          axis.text = element_blank(),
          axis.ticks = element_blank(),
          
          legend.position = "none",
          
          panel.border = element_blank(),
          panel.grid = element_blank(),
          panel.grid.major = element_blank(),
          panel.background = element_rect(fill="#F0F0F0",
                                          color="#F0F0F0"), 
          
          plot.background = element_rect(fill="#F0F0F0", color="#F0F0F0"),
          plot.title = element_text(face = "bold", size = "17"),
          plot.subtitle = element_text(color = "#6E6E6E", size= "15", 
                                       margin=margin(0,0,2,0)),
          plot.caption = element_text(size = "12", color = "white", hjust = "1"))

## The Footer 

footer<- grobTree(rectGrob(gp=gpar(fill="#5B5E5F", 
                                   lwd=0)), 
                  textGrob("      FIVETHIRTYEIGHT", x=unit(0, "npc"), 
                      gp=gpar(col="white", 
                              family="sans", 
                              fontsize=8),
                      hjust=0),
                  
                  textGrob("SOURCE: SURVEYMONKEY AUDIENCE      ",
                        x=unit(1, "npc"), 
                        gp=gpar(col="white", 
                                family= "sans",
                                fontsize=8),
                        hjust=1))
                  
# Plot All Together

 plt.final <- grid.arrange(map, footer, heights=unit(c(0.72, 0.03), 
                                                    c("npc", "npc")))

 ggsave("FavSides.pdf")
## Saving 5.5 x 7 in image

Happy Thanksgiving!

## By: Kieran Healey

datafile = "blog.revolutionanalytics.com/downloads/tdata.csv"
library(ggplot2)
x = read.csv(paste0("http://",datafile))
ggplot(x) + geom_tile(aes(x=H,y=T,fill=tc))+scale_fill_identity()+
  labs(title = "Happy Thanksgiving!")+
  theme(  axis.line.y=element_blank(),
          axis.line.x = element_blank(),
          axis.ticks = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank(),
          panel.background = element_blank())