Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message with geom_flag #36

Open
Bwe9403 opened this issue Aug 27, 2021 · 0 comments
Open

Error message with geom_flag #36

Bwe9403 opened this issue Aug 27, 2021 · 0 comments

Comments

@Bwe9403
Copy link

Bwe9403 commented Aug 27, 2021

Hi there,

I've been trying to add flags to a bar plot using geom_flag. I've been using the following code:

countrytotal$COWcode <- countrycode(countrytotal$Fleet, "country.name", "cown")
countrytotal$countryname <- countrycode(countrytotal$COWcode, "cown", "country.name")
countrytotal$iso2 <- countrycode(countrytotal$countryname, "country.name", "iso2c")
countrytotal$iso2_lower <- tolower(countrytotal$iso2)

plot1 <- ggplot(data=countrytotal, aes(x=Fleet, y=totalcatch)) +
geom_bar(stat="identity") +
coord_flip() + expand_limits(y = -4)
plot1 + geom_flag(aes(y =-4, image = iso2_lower), data=countrytotal)

I continue to get the error message of Error in class(grobs) <- "gList" : attempt to set an attribute on NULL.

Any thoughts on what may be going on? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant