Skip to content

brunomioto/futebolplotR

Repository files navigation

futebolplotR

Lifecycle: experimental CRAN status

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.

The FutebolplotR contains logos of the teams participating in the Brasileirão Série A football league from 2003 to the nowadays.

Installation

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")

Using 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")

About

Brazilian Soccer badges Plots in 'ggplot2'

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Languages