You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is my use case: My data set has MANY countries and it is not useful to plot all countries when most of them after the top 8 have very small percentages. So I create a category called "Other" to group all other countries together, which I also want to represent on the plot. But then I get the error stated above. I wish there was a way to plot custom categories or just NA values (but that it also appears in the plot legend).
packageVersion("ggflags")
#> [1] '0.0.4'country_4legend<- c("us", "gb", "nl", "de", "ca", "be", "au", "ru", "other")
df<-data.frame(x= rep(1:10, each=10),
y= rep(1:10, 10),
country= c(country_4legend[-9],
rep(country_4legend, each=10), "other", "other"))
# Custom category doesn't workggplot2::ggplot(df, ggplot2::aes(x, y, country=country)) +ggflags::geom_flag(size=8.5)
#> Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'grobify' for signature '"NULL"'# Missing values workcountry_4legend<- c("us", "gb", "nl", "de", "ca", "be", "au", "ru", NA)
df<-data.frame(x= rep(1:10, each=10),
y= rep(1:10, 10),
country= c(rep(country_4legend, each=11), NA))
ggplot2::ggplot(df, ggplot2::aes(x, y, country=country)) +ggflags::geom_flag(size=8.5)
#> Warning: Removed 12 rows containing missing values or values outside the scale range#> (`geom_flag()`).
# But not the legendggplot2::ggplot(df, ggplot2::aes(x, y, country=country)) +ggflags::geom_flag(size=8.5) +ggflags::scale_country(breaks=country_4legend)
#> Warning: Removed 12 rows containing missing values or values outside the scale range#> (`geom_flag()`).#> Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'grobify' for signature '"NULL"'country_4legend2<- c(country_4legend[-9], "NA")
ggplot2::ggplot(df, ggplot2::aes(x, y, country=country)) +ggflags::geom_flag(size=8.5) +ggflags::scale_country(breaks=country_4legend2)
#> Warning: Removed 12 rows containing missing values or values outside the scale range#> (`geom_flag()`).
Follow-up on #6 and #10.
Here is my use case: My data set has MANY countries and it is not useful to plot all countries when most of them after the top 8 have very small percentages. So I create a category called "Other" to group all other countries together, which I also want to represent on the plot. But then I get the error stated above. I wish there was a way to plot custom categories or just NA values (but that it also appears in the plot legend).
Created on 2024-05-31 with reprex v2.1.0
The text was updated successfully, but these errors were encountered: