Skip to content

Commit

Permalink
Fix flag rendering; amend pkg authors
Browse files Browse the repository at this point in the history
  • Loading branch information
James Goldie committed Sep 29, 2023
1 parent 328d4bf commit ef36c4a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
18 changes: 15 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@ Package: ggflags
Type: Package
Version: 0.0.3
Title: Plot flags of the world in ggplot2
Authors@R: c(person("Baptiste", "Auguie",
Authors@R: c(
person("Baptiste", "Auguie",
email = "[email protected]",
role = c("aut", "cre")),
person("James", "Goldie",
email = "[email protected]",
role = c("ctb")))
email = "[email protected]",
role = c("aut", "ctb"),
comment = c(
ORCID = "0000-0002-5024-6207"
)),
person(
given = "Rémi",
family = "Thériault",
role = c("aut", "ctb"),
email = "[email protected]",
comment = c(
ORCID = "0000-0003-4315-6788",
Twitter = "@rempsyc")))
License: GPL (>= 3)
Description: A ggplot2 extension that allows you to plot the flags of the world. It functions essentially
as geom_point does, requiring, at minimum, a two-letter lowercase country code for the country aesthetic,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Generated by roxygen2: do not edit by hand

S3method(grid::makeContent,flag)
export(geom_flag)
export(scale_country)
8 changes: 5 additions & 3 deletions R/geom_flag.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ GeomFlag <- ggplot2::ggproto("GeomFlag", ggplot2::Geom,

#' @noRd
flagGrob <- function(x, y, country, size = 1, alpha = 1) {
# grob(x=x, y=y, country=country, size=size, cl = "flag")
grid::gTree(x = x, y = y, country = country, size = size, cl = "flag")
}

#' @noRd
#' @exportS3Method grid::makeContent
makeContent.flag <- function(x) {
.flaglist <- utils::data(".flaglist")
flag_pics <- lapply(
seq_along(x$country),
function(ii) {
Expand All @@ -77,4 +76,7 @@ makeContent.flag <- function(x) {
}
)
grid::setChildren(x, do.call(grid::gList, flag_pics))
}
}

#' @noRd
utils::globalVariables(c(".flaglist"))

0 comments on commit ef36c4a

Please sign in to comment.