The code for this package was copied heavily from nbaplotR with minor changes to support Brazilian soccer team badges.
The goal of futebolplotR is to provide functions and geoms that help visualization of Brazilian soccer related analysis. It provides a ggplot2 geom that does the heavy lifting of plotting brazilian soccer logos in high quality, with correct aspect ratio and possible transparency.
To get a bug fix or to use a feature from the development version, you can install the development version of futebolplotR either from GitHub with:
if (!require("pak")) install.packages("pak")
pak::pak("brunomioto/futebolplotR")
The key function in the package is geom_futebol_logos() which will add Brazilian soccer team logos to a ggplot. Here you can see all the current available teams to plot.
#library(futebolplotR)
library(ggplot2)
team <- valid_team_names()
df <- data.frame(
a = c(rep(1:5, 8),c(1,2,3)),
b = sort(c(rep(1:8, 5), c(0,0,0)), decreasing = TRUE),
teams = team
)
ggplot(df, aes(x = a, y = b)) +
geom_futebol_badges(aes(team_abbr = teams), width = 0.1) +
geom_label(aes(label = teams,
color = teams,
fill = teams),
nudge_y = -0.35)+
scale_color_futebol(type = "secondary")+
scale_fill_futebol(type = "primary")+
theme_void()+
theme(
plot.margin = margin(15,15,15,15,"pt")
)+
coord_cartesian(clip = "off")