library("dplyr")
#> Warning: le package 'dplyr' a été compilé avec la version R 4.3.2
#>
#> Attachement du package : 'dplyr'
#> Les objets suivants sont masqués depuis 'package:stats':
#>
#> filter, lag
#> Les objets suivants sont masqués depuis 'package:base':
#>
#> intersect, setdiff, setequal, union
data("aravo", package = "ade4")
# All red should be all blue
aravo$traits %>%
tibble::rownames_to_column("species") %>%
funbiogeo::fb_plot_species_traits_completeness()
Bug description
See issue title
Reproducible example
Created on 2024-04-09 with reprex v2.1.0
The problem comes from the fact that the colors are defined here:
https://github.com/FRBCesab/funbiogeo/blob/faaad76e42ba2da125978eea9ddb87c436b8eff2/R/fb_plot_species_traits_completeness.R#L233-L236
If the entirety of "has_trait" column is TRUE, then only the first color of ColorBrewer Set1 is used -> the red
The fix is quite easy: change from using
scale_fill_brewer()
toscale_fill_manual()
with the colors set up as the two first colors of Color Brewer.