wilkelab / cowplot

cowplot: Streamlined Plot Theme and Plot Annotations for ggplot2
https://wilkelab.org/cowplot/
701 stars 84 forks source link

fix warning message: deprecated arguments #189

Closed Yunuuuu closed 1 year ago

Yunuuuu commented 1 year ago

adjust to ggplot2 parameters

clauswilke commented 1 year ago

Please file an issue first, then we can discuss an appropriate PR.

Yunuuuu commented 1 year ago

Sorry, I'll open a issue, and now, I'll give a description of the problem this commit fixed. When I used function (like scater::plotColData) which internally called theme function from cowplot there always prompts some annoying message by ggplot2 deprecated arguments size from element_text() and element_rect(). A minimal example:

library(ggplot2)
library(cowplot)

ggplot(mtcars) +
    geom_point(aes(mpg, drat)) +
    theme_cowplot()

Warning messages:
1: The `size` argument of `element_line()` is
deprecated as of ggplot2 3.4.0.
ℹ Please use the `linewidth` argument instead.
ℹ The deprecated feature was likely used in the
  cowplot package.
  Please report the issue at
  <https://github.com/wilkelab/cowplot/issues>.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to
see where this warning was generated. 
2: The `size` argument of `element_rect()` is
deprecated as of ggplot2 3.4.0.
ℹ Please use the `linewidth` argument instead.
ℹ The deprecated feature was likely used in the
  cowplot package.
  Please report the issue at
  <https://github.com/wilkelab/cowplot/issues>.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to
see where this warning was generated. 
Yunuuuu commented 1 year ago

fix https://github.com/wilkelab/cowplot/issues/190

Yunuuuu commented 1 year ago

And maybe we shoud add a dependencies of ggplot2 (> 3.4.0) ?

Yunuuuu commented 1 year ago

The latest ggplot2 has been published: https://github.com/tidyverse/ggplot2/releases/tag/v3.4.0

clauswilke commented 1 year ago

Apologies for the absence on my end. Could you do the following, and then I'm happy to merge:

  1. Update the ggplot2 dependency so it's clear we will need >= 3.4.0 going forward
  2. Make an entry in NEWS.md describing the changes. I encourage you to acknowledge your contribution as described here.

Also, can you confirm that you have searched the codebase and found all instances that require this change? Thanks for your efforts!

Yunuuuu commented 1 year ago

I have searched element_line and element_rect use vscode. all related size argument have beee substituted by linewidth

clauswilke commented 1 year ago

Thanks!