nanxstats / ggsci

🦄 Scientific journal and sci-fi themed color palettes for ggplot2
https://nanx.me/ggsci/
GNU General Public License v3.0
661 stars 71 forks source link

Backward compatibility with ggplot2 < 3.5.0 #29

Closed nanxstats closed 5 months ago

nanxstats commented 6 months ago

Using ggsci 3.0.2 (the version that removes scale_name argument) with ggplot2 < 3.5.0, it will complain:

Error in `discrete_scale()`:
! argument "scale_name" is missing, with no default
Backtrace:
 1. ggsci::scale_color_npg()
 2. ggplot2::discrete_scale(...)
 3. ggplot2::ggproto(...)
 4. rlang::list2(...)
Execution halted

There are two options:

  1. We could declare the minimum version ggplot2 (>= 3.5.0) in DESCRIPTION, As suggested by https://github.com/nanxstats/ggsci/issues/25#issuecomment-2014550991, although that would require users to upgrade ggplot2.

  2. Determine the ggplot2 version live and then branch off, to keep it backward compatible. This seem related: shiny:::is_installed().