This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
# Load the tidyverse
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(scales)
##
## Attaching package: 'scales'
##
## The following object is masked from 'package:purrr':
##
## discard
##
## The following object is masked from 'package:readr':
##
## col_factor
# Import data
fast <-
read.csv("https://raw.githubusercontent.com/kitadasmalley/Teaching/main/DATA502/FA2023/Data/fastFood2022.csv")
## Change Units
fast<-fast%>%
mutate(avg_sales_per_mil=avg_sales_per_thousand/1000)
summary(fast)
## rank company category systemwide_sales
## Min. : 1.00 Length:50 Length:50 Min. : 685
## 1st Qu.:13.25 Class :character Class :character 1st Qu.: 1013
## Median :25.50 Mode :character Mode :character Median : 2531
## Mean :25.50 Mean : 5349
## 3rd Qu.:37.75 3rd Qu.: 5412
## Max. :50.00 Max. :48734
## avg_sales_per_thousand franchised_licensed_units company_units
## Min. : 300 Min. : 0 Min. : 0.0
## 1st Qu.:1161 1st Qu.: 495 1st Qu.: 33.5
## Median :1612 Median : 1152 Median : 173.0
## Mean :1904 Mean : 2694 Mean : 515.4
## 3rd Qu.:2097 3rd Qu.: 3142 3rd Qu.: 401.2
## Max. :6710 Max. :20576 Max. :9265.0
## total_units change_units avg_sales_per_mil
## Min. : 287.0 Min. :-571.0 Min. :0.300
## 1st Qu.: 792.5 1st Qu.: -10.5 1st Qu.:1.161
## Median : 1714.0 Median : 21.5 Median :1.612
## Mean : 3209.5 Mean : 44.8 Mean :1.904
## 3rd Qu.: 3513.2 3rd Qu.: 85.0 3rd Qu.:2.097
## Max. :20576.0 Max. : 429.0 Max. :6.710
head(fast)
## rank company category systemwide_sales avg_sales_per_thousand
## 1 1 McDonald's Burger 48734 3625
## 2 2 Starbucks* Snack 28100 1680
## 3 3 Chick-fil-A* Chicken 18814 6710
## 4 4 Taco Bell Global 13850 1900
## 5 5 Wendy's Burger 11694 1973
## 6 6 Dunkin' Snack 11279 1200
## franchised_licensed_units company_units total_units change_units
## 1 12751 693 13444 6
## 2 6608 9265 15873 429
## 3 2764 73 2837 153
## 4 6734 464 7198 196
## 5 5591 403 5994 56
## 6 9339 31 9370 126
## avg_sales_per_mil
## 1 3.625
## 2 1.680
## 3 6.710
## 4 1.900
## 5 1.973
## 6 1.200
unique(fast$company)
## [1] "McDonald's"
## [2] "Starbucks*"
## [3] "Chick-fil-A*"
## [4] "Taco Bell"
## [5] "Wendy's"
## [6] "Dunkin'"
## [7] "Subway*"
## [8] "Burger King"
## [9] "Domino's"
## [10] "Chipotle"
## [11] "Panera Bread*"
## [12] "Pizza Hut"
## [13] "Sonic Drive-In"
## [14] "Panda Express"
## [15] "KFC"
## [16] "Popeyes Louisiana Kitchen"
## [17] "Dairy Queen"
## [18] "Arby's"
## [19] "Jack in the Box"
## [20] "Papa Johns"
## [21] "Little Caesars*"
## [22] "Whataburger"
## [23] "Raising Cane's"
## [24] "Culver's"
## [25] "Jersey Mike's"
## [26] "Wingstop"
## [27] "Zaxby's"
## [28] "Jimmy John's"
## [29] "Five Guys"
## [30] "Hardee's"
## [31] "Bojangles"
## [32] "Carl's Jr."
## [33] "Dutch Bros"
## [34] "Firehouse Subs"
## [35] "In-N-Out Burger*"
## [36] "Tropical Smoothie Caf\x8e"
## [37] "El Pollo Loco"
## [38] "Crumbl Cookies"
## [39] "QDOBA"
## [40] "Shake Shack*"
## [41] "Krispy Kreme*"
## [42] "Marco's Pizza"
## [43] "Del Taco"
## [44] "McAlister's Deli"
## [45] "Checkers/Rally's"
## [46] "Freddy's Frozen Custard & Steakburgers"
## [47] "Church's Chicken"
## [48] "Papa Murphy's"
## [49] "Moe's"
## [50] "Baskin-Robbins"
#dots
my_hex_color1 <- "#3d4e7f"
#background
my_hex_color2 <- "#f3fbfb"
#mcd
my_hex_color3 <- "#e40605"
#title
my_hex_color4 <- "#74acbc"
#lines/other
my_hex_color5 <- "#8e999f"
fast$total_units <- as.numeric(fast$total_units)
fast$avg_sales_per_mil <- as.numeric(fast$avg_sales_per_mil)
any(is.na(fast))
## [1] FALSE
## Warning: Removed 1 rows containing missing values (`geom_point()`).
scale_x_continuous(limits = c(1, 5), breaks = seq(1, 5, by = 1)) + labs(x = “X-axis Label”, y = “Y-axis Label”, title = “ggplot Example”)+ theme(legend.position = “none”)
#dots
my_hex_color1 <- "#3d4e7f"
#background
my_hex_color2 <- "#f3fbfb"
#mcd
my_hex_color3 <- "#e40605"
#title
my_hex_color4 <- "#74acbc"
#lines/other
my_hex_color5 <- "#8e999f"
ggplot(fast, aes(total_units, avg_sales_per_mil, size=systemwide_sales)) +
geom_point(alpha=0.6, color=my_hex_color1) +
scale_x_continuous(
breaks = seq(0, 20000, by = 2500),
labels = seq(0, 20000, by = 2500),
limits = c(0, 20000)
) +
scale_y_continuous(
breaks = seq(0, 7, by = 1),
labels = paste0("$", seq(0, 7, by = 1), "m"),
limits = c(0, 7)
) +
labs(x = "Total US Stores", y = "Total Units vs Average Revenue") +
theme(
axis.text.y = element_text(angle = 0, hjust = 1, color = my_hex_color5),
axis.text.x = element_text(color = my_hex_color5),
axis.title.y = element_text(angle = 90, vjust = 0.5, hjust = 0, color = my_hex_color5),
axis.line.y = element_line(color = my_hex_color5),
axis.line.x = element_line(color = my_hex_color5),
axis.title.x = element_text(color = my_hex_color5),
panel.background = element_rect(fill = my_hex_color2),
plot.background = element_rect(fill = my_hex_color2),
title = element_text(color = my_hex_color4),
legend.position = "none",
panel.grid.major = element_line(color ="grey98"),
panel.grid.minor = element_line(color ="grey98")
) +
ggtitle("America's Fast Food Landscape: McDonald's Still Reigns Supreme")
## Warning: Removed 1 rows containing missing values (`geom_point()`).
#dots
my_hex_color1 <- "#3d4e7f"
#background
my_hex_color2 <- "#f3fbfb"
#mcd
my_hex_color3 <- "#e40605"
#title
my_hex_color4 <- "#74acbc"
#lines/other
my_hex_color5 <- "#8e999f"
ggplot(fast, aes(total_units, avg_sales_per_mil, size=systemwide_sales)) +
geom_point(alpha=0.6, color=my_hex_color1) +
scale_x_continuous(
breaks = seq(0, 20000, by = 2500),
labels = seq(0, 20000, by = 2500),
limits = c(0, 20000)
) +
scale_y_continuous(
breaks = seq(0, 7, by = 1),
labels = paste0("$", seq(0, 7, by = 1), "m"),
limits = c(0, 7)
) +
scale_color_manual(values = c("McDonald's" = my_hex_color3))+
labs(x = "Total US Stores", y = "Total Units vs Average Revenue") +
theme(
axis.text.y = element_text(angle = 0, hjust = 1, color = my_hex_color5),
axis.text.x = element_text(color = my_hex_color5),
axis.title.y = element_text(angle = 90, vjust = 0.5, hjust = 0, color = my_hex_color5),
axis.line.y = element_line(color = my_hex_color5),
axis.line.x = element_line(color = my_hex_color5),
axis.title.x = element_text(color = my_hex_color5),
panel.background = element_rect(fill = my_hex_color2),
plot.background = element_rect(fill = my_hex_color2),
title = element_text(color = my_hex_color4),
legend.position = "none",
panel.grid.major = element_line(color ="grey98"),
panel.grid.minor = element_line(color ="grey98")
) +
ggtitle("America's Fast Food Landscape: McDonald's Still Reigns Supreme")+
annotate("text", x = 19000, y = 6.5,
label = "Top 50 Fast Food Chains in America",
color = my_hex_color5, size = 4, hjust = 1) +
annotate("text", x = 19000, y = 6.2,
label = "[Stores vs. sales per unit, bubble size = total sales]",
color = my_hex_color5, size = 3, hjust = 1)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
#dots
my_hex_color1 <- "#3d4e7f"
#background
my_hex_color2 <- "#f3fbfb"
#mcd
my_hex_color3 <- "#e40605"
#title
my_hex_color4 <- "#74acbc"
#lines/other
my_hex_color5 <- "#8e999f"
ggplot(fast, aes(total_units, avg_sales_per_mil, size = systemwide_sales, color = company)) +
geom_point(data = subset(fast, company == "McDonald's"), alpha = 0.6, color = my_hex_color3) +
geom_point(data = subset(fast, company != "McDonald's"), alpha = 0.6, color = my_hex_color1) +
scale_x_continuous(
breaks = seq(0, 20000, by = 2500),
labels = seq(0, 20000, by = 2500),
limits = c(0, 20000)
) +
scale_y_continuous(
breaks = seq(0, 7, by = 1),
labels = paste0("$", seq(0, 7, by = 1), "m"),
limits = c(0, 7)
) +
labs(x = "Total US Stores", y = "Total Units vs Average Revenue") +
theme(
axis.text.y = element_text(angle = 0, hjust = 1, color = my_hex_color5),
axis.text.x = element_text(color = my_hex_color5),
axis.title.y = element_text(angle = 90, vjust = 0.5, hjust = 0, color = my_hex_color5),
axis.line.y = element_line(color = my_hex_color5),
axis.line.x = element_line(color = my_hex_color5),
axis.title.x = element_text(color = my_hex_color5),
panel.background = element_rect(fill = my_hex_color2),
plot.background = element_rect(fill = my_hex_color2),
title = element_text(color = my_hex_color4),
legend.position = "none",
panel.grid.major = element_line(color = "grey98"),
panel.grid.minor = element_line(color = "grey98")
) +
ggtitle("America's Fast Food Landscape: McDonald's Still Reigns Supreme") +
annotate("text", x = 19000, y = 6.5,
label = "Top 50 Fast Food Chains in America",
color = my_hex_color5, size = 4, hjust = 1) +
annotate("text", x = 19000, y = 6.2,
label = "[Stores vs. sales per unit, bubble size = total sales]",
color = my_hex_color5, size = 3, hjust = 1)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
#dots
my_hex_color1 <- "#3d4e7f"
#background
my_hex_color2 <- "#f3fbfb"
#mcd
my_hex_color3 <- "#e40605"
#title
my_hex_color4 <- "#74acbc"
#lines/other
my_hex_color5 <- "#8e999f"
ggplot(fast, aes(total_units, avg_sales_per_mil, size = systemwide_sales, color = company)) +
geom_point(data = subset(fast, company == "McDonald's"), alpha = .8, color = my_hex_color3) +
geom_point(data = subset(fast, company != "McDonald's"), alpha = .8, color = my_hex_color1) +
scale_x_continuous(
breaks = seq(0, 20000, by = 2500),
labels = seq(0, 20000, by = 2500),
limits = c(0, 20000)
) +
scale_y_continuous(
breaks = seq(0, 7, by = 1),
labels = paste0("$", seq(0, 7, by = 1), "m"),
limits = c(0, 7)
) +
labs(x = "Total US Stores", y = "Total Units vs Average Revenue") +
theme(
axis.text.y = element_text(angle = 0, hjust = 1, color = my_hex_color5),
axis.text.x = element_text(color = my_hex_color5),
axis.title.y = element_text(angle = 90, vjust = 0.5, hjust = 0, color = my_hex_color5),
axis.line.y = element_line(color = my_hex_color5),
axis.line.x = element_line(color = my_hex_color5),
axis.title.x = element_text(color = my_hex_color5),
panel.background = element_rect(fill = my_hex_color2),
plot.background = element_rect(fill = my_hex_color2),
title = element_text(color = my_hex_color4),
legend.position = "none",
panel.grid.major = element_line(color = "grey98"),
panel.grid.minor = element_line(color = "grey98")
) +
ggtitle("America's Fast Food Landscape: McDonald's Still Reigns Supreme") +
annotate("text", x = 19000, y = 6.5,
label = "Top 50 Fast Food Chains in America",
color = my_hex_color5, size = 4, hjust = 1) +
annotate("text", x = 19000, y = 6.2,
label = "[Stores vs. sales per unit, bubble size = total sales]",
color = my_hex_color5, size = 3, hjust = 1)+
annotate("text", x = 0, y = 0,
label = "Source: The QSR 2023 Top 50",
color = my_hex_color5, size = 3, hjust = 0)
## Warning: Removed 1 rows containing missing values (`geom_point()`).
#dots
my_hex_color1 <- "#3d4e7f"
#background
my_hex_color2 <- "#f3fbfb"
#mcd
my_hex_color3 <- "#e40605"
#title
my_hex_color4 <- "#74acbc"
#lines/other
my_hex_color5 <- "#8e999f"
companies_to_label <- c("McDonald's", "Taco Bell", "Chipotle", "Starbucks*", "Dunkin'")
Data502Midterm1 <- ggplot(fast, aes(total_units, avg_sales_per_mil, size = systemwide_sales, color = company)) +
geom_point(data = subset(fast, company == "McDonald's"), alpha = .7, color = my_hex_color3) +
geom_point(data = subset(fast, company != "McDonald's"), alpha = .7, color = my_hex_color1) +
geom_text(data = subset(fast, company %in% companies_to_label),
aes(label = company),
hjust = -.25, vjust = .5, color = my_hex_color1, size = 2.2)+
scale_x_continuous(
breaks = seq(0, 20000, by = 2500),
labels = seq(0, 20000, by = 2500),
limits = c(0, 20000)
) +
scale_y_continuous(
breaks = seq(0, 7, by = 1),
labels = paste0("$", seq(0, 7, by = 1), "m"),
limits = c(0, 7)
) +
labs(x = "Total US Stores", y = "Average Revenue Per Restaurant Unit") +
theme(
axis.text.y = element_text(angle = 0, hjust = 1, color = my_hex_color5),
axis.text.x = element_text(color = my_hex_color5),
axis.title.y = element_text(angle = 90, vjust = 0.5, color = my_hex_color5, size=9, hjust=.50, face= "plain"),
axis.line.y = element_line(color = my_hex_color5),
axis.line.x = element_line(color = my_hex_color5),
axis.title.x = element_text(color = my_hex_color5, size =7, hjust=.75, face="plain"),
panel.background = element_rect(fill = my_hex_color2),
plot.background = element_rect(fill = my_hex_color2),
title = element_text(color = my_hex_color4, size = 15, face = "bold", hjust = 2, vjust = 0.5),
legend.position = "none",
panel.grid.major = element_line(color = "grey98"),
panel.grid.minor = element_line(color = "grey98")
) +
ggtitle("America's Fast Food Landscape:\nMcDonald's Still Reigns Supreme") +
annotate("text", x = 19000, y = 6.5,
label = "Top 50 Fast Food Chains in America",
color = my_hex_color5, size = 4, hjust = 1) +
annotate("text", x = 19000, y = 6,
label = "[Stores vs. sales per unit, bubble size = total sales]",
color = my_hex_color5, size = 3, hjust = 1)+
annotate("text", x = 0, y = 0,
label = "Source: The QSR 2023 Top 50",
color = my_hex_color5, size = 3, hjust = 0)
#save to pdf
ggsave("RecreateMidterm.pdf", plot = Data502Midterm1, width = 6, height = 4, units = "in")
## Warning: Removed 1 rows containing missing values (`geom_point()`).
#done with recreate
unique(fast$category)
## [1] "Burger" "Snack" "Chicken" "Global" "Sandwich" "Pizza"
head(fast, n=20)
## rank company category systemwide_sales
## 1 1 McDonald's Burger 48734
## 2 2 Starbucks* Snack 28100
## 3 3 Chick-fil-A* Chicken 18814
## 4 4 Taco Bell Global 13850
## 5 5 Wendy's Burger 11694
## 6 6 Dunkin' Snack 11279
## 7 7 Subway* Sandwich 10372
## 8 8 Burger King Burger 10278
## 9 9 Domino's Pizza 8752
## 10 10 Chipotle Global 8600
## 11 11 Panera Bread* Sandwich 6787
## 12 12 Pizza Hut Pizza 5500
## 13 13 Sonic Drive-In Burger 5499
## 14 14 Panda Express Global 5149
## 15 15 KFC Chicken 5100
## 16 16 Popeyes Louisiana Kitchen Chicken 5001
## 17 17 Dairy Queen Snack 4579
## 18 18 Arby's Sandwich 4535
## 19 19 Jack in the Box Burger 4111
## 20 20 Papa Johns Pizza 3698
## avg_sales_per_thousand franchised_licensed_units company_units total_units
## 1 3625 12751 693 13444
## 2 1680 6608 9265 15873
## 3 6710 2764 73 2837
## 4 1900 6734 464 7198
## 5 1973 5591 403 5994
## 6 1200 9339 31 9370
## 7 510 20576 0 20576
## 8 1508 6993 50 7043
## 9 1309 6400 286 6686
## 10 2800 0 3129 3129
## 11 3230 1156 946 2102
## 12 1033 6540 21 6561
## 13 1600 3221 325 3546
## 14 2385 162 2231 2393
## 15 1341 3872 46 3918
## 16 1823 2905 41 2946
## 17 1063 4305 2 4307
## 18 1300 2305 1110 3415
## 19 1837 2034 146 2180
## 20 1169 2854 522 3376
## change_units avg_sales_per_mil
## 1 6 3.625
## 2 429 1.680
## 3 153 6.710
## 4 196 1.900
## 5 56 1.973
## 6 126 1.200
## 7 -571 0.510
## 8 -61 1.508
## 9 126 1.309
## 10 211 2.800
## 11 -33 3.230
## 12 13 1.033
## 13 -6 1.600
## 14 87 2.385
## 15 -35 1.341
## 16 169 1.823
## 17 -32 1.063
## 18 6 1.300
## 19 -38 1.837
## 20 37 1.169
ggplot(fast, aes(x = total_units, y = avg_sales_per_mil, size = franchised_licensed_units, color = category)) +
geom_point() +
scale_size_continuous(name = "Franchised Licensed Units", guide = "none") +
scale_color_discrete(name = "Main Food Offering") +
labs(title= "Change me", x = "Total US Stores", y = "Average Revenue Per Restaurant Unit") +
theme(
axis.text.y = element_text(angle = 0, hjust = 1, color = my_hex_color5),
axis.text.x = element_text(color = my_hex_color5),
axis.title.y = element_text(angle = 90, vjust = 0.5, color = my_hex_color5, size=9, hjust=.50, face= "plain"),
axis.line.y = element_line(color = my_hex_color5),
axis.line.x = element_line(color = my_hex_color5),
axis.title.x = element_text(color = my_hex_color5, size =7, hjust=.75, face="plain"),
panel.background = element_rect(fill = my_hex_color2),
plot.background = element_rect(fill = my_hex_color2),
title = element_text(color = my_hex_color4, size = 15, face = "bold", hjust = 2, vjust = 0.5),
panel.grid.major = element_line(color = "grey98"),
panel.grid.minor = element_line(color = "grey98")
)
companies_to_label <- c("McDonald's", "Taco Bell", "Subway*", "Starbucks*", "Domino's", "Chick-fil-A*")
ggplot(fast, aes(x = total_units, y = avg_sales_per_mil, size = franchised_licensed_units, color = category)) +
geom_point(alpha = 0.7) +
scale_size_continuous(name = "Franchised Licensed Units", guide = "none") +
scale_color_discrete(name = "Main Food Category") +
labs(title= "Change me", x = "Total US Stores", y = "Average Revenue Per Restaurant Unit") +
geom_text(data = subset(fast, company %in% companies_to_label),
aes(label = company),
hjust = -.1, vjust = .5, color = my_hex_color1, size = 2.2)+
scale_x_continuous(
breaks = seq(0, 22500, by = 2500),
labels = seq(0, 22500, by = 2500),
limits = c(0, 22500)
) +
scale_y_continuous(
breaks = seq(0, 7, by = 1),
labels = paste0("$", seq(0, 7, by = 1), "m"),
limits = c(0, 7)
) +
theme(
axis.text.y = element_text(angle = 0, hjust = 1, color = my_hex_color5),
axis.text.x = element_text(color = my_hex_color5),
axis.title.y = element_text(angle = 90, vjust = 0.5, color = my_hex_color5, size=9, hjust=.50, face= "plain"),
axis.line.y = element_line(color = my_hex_color5),
axis.line.x = element_line(color = my_hex_color5),
axis.title.x = element_text(color = my_hex_color5, size =7, hjust=.75, face="plain"),
panel.background = element_rect(fill = my_hex_color2),
plot.background = element_rect(fill = my_hex_color2),
title = element_text(color = my_hex_color4, size = 15, face = "bold", hjust = 2, vjust = 0.5),
panel.grid.major = element_line(color = "grey98"),
panel.grid.minor = element_line(color = "grey98"),
legend.text = element_text(size = 7),
legend.title = element_text(size = 10)
)+
ggtitle("America's Fast Food Landscape:\nSubway Reigns Supreme in Franchises") +
annotate("text", x = 22500, y = 6,
label = "Top 50 Fast Food Chains in America",
color = my_hex_color5, size = 3, hjust = 1) +
annotate("text", x = 22500, y = 5.5,
label = "[Stores vs. sales per unit, bubble size = total number of franchise units]",
color = my_hex_color5, size = 2, hjust = 1)+
annotate("text", x = 0, y = 0,
label = "Source: The QSR 2023 Top 50",
color = my_hex_color5, size = 3, hjust = 0)
#new
companies_to_label <- c("McDonald's", "Taco Bell", "Subway*", "Starbucks*", "Pizza Hut", "Chick-fil-A*")
Data502Midterm1_2 <- ggplot(fast, aes(x = total_units, y = avg_sales_per_mil, size = franchised_licensed_units, color = category)) +
geom_point(alpha = 0.7) +
scale_size_continuous(name = "Franchised Licensed Units", guide = "none") +
scale_color_discrete(name = "Main Food Category") +
labs(title= "Change me", x = "Total US Stores", y = "Average Revenue Per Restaurant Unit") +
geom_text(data = subset(fast, company %in% companies_to_label),
aes(label = company),
hjust = -.2, vjust = .5, color = my_hex_color1, size = 2.2)+
scale_x_continuous(
breaks = seq(0, 22500, by = 2500),
labels = seq(0, 22500, by = 2500),
limits = c(0, 22500)
) +
scale_y_continuous(
breaks = seq(0, 7, by = 1),
labels = paste0("$", seq(0, 7, by = 1), "m"),
limits = c(0, 7)
) +
theme(
axis.text.y = element_text(angle = 0, hjust = 1, color = my_hex_color5),
axis.text.x = element_text(color = my_hex_color5),
axis.title.y = element_text(angle = 90, vjust = 0.5, color = my_hex_color5, size=9, hjust=.50, face= "plain"),
axis.line.y = element_line(color = my_hex_color5),
axis.line.x = element_line(color = my_hex_color5),
axis.title.x = element_text(color = my_hex_color5, size =7, hjust=.75, face="plain"),
panel.background = element_rect(fill = my_hex_color2),
plot.background = element_rect(fill = my_hex_color2),
title = element_text(color = my_hex_color4, size = 15, face = "bold", hjust = 2, vjust = 0.5),
panel.grid.major = element_line(color = "grey98"),
panel.grid.minor = element_line(color = "grey98"),
legend.text = element_text(size = 7),
legend.title = element_text(size = 10)
)+
ggtitle("America's Fast Food Landscape:\nSubway Reigns Supreme in Franchises") +
annotate("text", x = 21000, y = 6,
label = "Top 50 Fast Food Chains in America",
color = my_hex_color5, size = 3, hjust = 1) +
annotate("text", x = 22500, y = 5.5,
label = "[Stores vs. sales per unit, bubble size = total number of franchise units]",
color = my_hex_color5, size = 2, hjust = 1)+
annotate("text", x = 0, y = 0,
label = "Source: The QSR 2023 Top 50",
color = my_hex_color5, size = 3, hjust = 0)
#save to pdf
ggsave("AlternativeMidterm.pdf", plot = Data502Midterm1_2, width = 8, height = 5, units = "in")