mlbplotR

R package to easily plot MLB logos

https://github.com/camdenk/mlbplotr

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.1%) to scientific vocabulary

Keywords

baseball ggplot2 r rstats sportsdataverse
Last synced: 6 months ago · JSON representation

Repository

R package to easily plot MLB logos

Basic Info
Statistics
  • Stars: 22
  • Watchers: 2
  • Forks: 1
  • Open Issues: 5
  • Releases: 2
Topics
baseball ggplot2 r rstats sportsdataverse
Created about 4 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%",
  dpi = 600
)
```

# mlbplotR 


[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg?style=flat-square)](https://lifecycle.r-lib.org/articles/stages.html)
[![R-CMD-check](https://github.com/camdenk/mlbplotR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/camdenk/mlbplotR/actions/workflows/R-CMD-check.yaml)


The code for this package was copied heavily from [nflplotR](https://nflplotr.nflverse.com/index.html) with minor changes to support Major League Baseball logos.


The goal of mlbplotR is to provide functions and geoms that help with visualizations of MLB related analysis. It provides ggplot2 geoms that do the heavy lifting of plotting MLB logos in high quality, with correct aspect ratio, and possible transparency.

## Installation

The easiest way to get mlbplotR is to install it from  [CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("mlbplotR")
```

To get a bug fix or use a feature from the development version, you can install the development version from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("camdenk/mlbplotR")
```
## Usage

Let's plot every team on a grid with some extra customization:

```{r every-team, message = FALSE}
library(mlbplotR)
library(ggplot2)
library(dplyr)

teams_colors_logos <- mlbplotR::load_mlb_teams() |> 
  dplyr::filter(!team_abbr %in% c("AL", "NL", "MLB")) |> 
  dplyr::mutate(
    a = rep(1:6, 5),
    b = sort(rep(1:5, 6), decreasing = TRUE)
  )


 ggplot2::ggplot(teams_colors_logos, aes(x = a, y = b)) +
   mlbplotR::geom_mlb_logos(aes(team_abbr = team_abbr), width = 0.075) +
   ggplot2::geom_label(aes(label = team_abbr), nudge_y = -0.35, alpha = 0.5) +
   ggplot2::theme_void() 
```

There is a [getting started guide](https://camdenk.github.io/mlbplotR/articles/mlbplotR.html) that will walk you through more use cases for the package.


## Contributing

-   [Open an issue](https://github.com/camdenk/mlbplotR/issues/new/choose) if you'd like to request specific data or report a bug/error.

Owner

  • Name: Camden Kay
  • Login: camdenk
  • Kind: user
  • Location: Arlington, TX
  • Company: Texas Rangers

GitHub Events

Total
  • Issues event: 1
  • Watch event: 2
  • Issue comment event: 1
  • Push event: 13
  • Pull request event: 2
Last Year
  • Issues event: 1
  • Watch event: 2
  • Issue comment event: 1
  • Push event: 13
  • Pull request event: 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 10
  • Total pull requests: 7
  • Average time to close issues: 7 days
  • Average time to close pull requests: 23 days
  • Total issue authors: 5
  • Total pull request authors: 2
  • Average comments per issue: 1.1
  • Average comments per pull request: 0.14
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • camdenk (5)
  • jacobakaye (2)
  • eriklarsen4 (1)
  • chemanuel228 (1)
  • peytonsumpter (1)
Pull Request Authors
  • camdenk (6)
  • ReedZahradnik5 (1)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels
refactor (1)

Packages

  • Total packages: 1
  • Total downloads:
    • cran 278 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: mlbplotR

Create 'ggplot2' and 'gt' Visuals with Major League Baseball Logos

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 278 Last month
Rankings
Stargazers count: 17.9%
Forks count: 28.8%
Dependent packages count: 29.8%
Average: 33.4%
Dependent repos count: 35.5%
Downloads: 55.3%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • cli * imports
  • data.table * imports
  • ggplot2 * imports
  • glue * imports
  • gt * imports
  • magick * imports
  • magrittr * imports
  • rlang * imports
  • scales * imports
  • tibble * imports
  • baseballr * suggests
  • dplyr * suggests
  • ggtext * suggests
  • gridtext * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • rstudioapi * suggests
  • rsvg * suggests
  • tidyr * suggests
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action 4.1.4 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite