Skip to content

ggmcmc() plotting functions returning warnings #83

Description

@mnkwarshie

Hi there!

I hope you're doing well. I have encountered two small issues that I would like to bring to your attention that I believe are due to recent updates to the ggplot2 package.

  1. fortify() warning from ggs_compare_partial() when using ggmcmc version 1.5.1.2 and ggplot2 version 4.0.1

The ggs_compare_partial() function is returning the following warning,

ggs_compare_partial(ggs(s))`

Warning message:
In fortify(data, ...) :
  Arguments in `...` must be used.
✖ Problematic argument:
• group = Chain
ℹ Did you misspell an argument name?

which I believe is due to the group argument being passed outside of the aes() call in line 34 of ggs_compare_partial()'s source code:

 # Generate the plot
  f <- ggplot(D.comp, aes(x=value, fill=part_chain, colour=part_chain), group=Chain) + 
    geom_density(alpha=0.4)

This warning is also produced when ggmcmc() is called:

   library(ggmcmc)
>   data("radon")
>   s.radon.short <- radon$s.radon.short
>   S <- ggs(s.radon.short)
>   path = tempfile(fileext = ".pdf")
>   ggmcmc(S, file = path)
Plotting histograms
Plotting density plots
Plotting traceplots
Plotting running means
Plotting comparison of partial and full chain
Plotting autocorrelation plots
Plotting crosscorrelation plot
Plotting Potential Scale Reduction Factors
Plotting shrinkage of Potential Scale Reduction Factors
Plotting Number of effective independent draws
Plotting Geweke Diagnostic
Plotting caterpillar plot
Time taken to generate the report: 5.4 seconds.
Warning messages:
1: In fortify(data, ...) :
  Arguments in `...` must be used.
✖ Problematic argument:
• group = Chain
ℹ Did you misspell an argument name?
2: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
ℹ The deprecated feature was likely used in the ggmcmc package.
  Please report the issue at <https://github.com/xfim/ggmcmc/issues/>.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. 

In a minimally reproducible example, passing the group argument outside of the aes() call returns the same warning. I believe that updating the source code to have group inside of aes() should fix this warning.

> library(ggplot2)
> # Dummy data
> df <- data.frame(
+   value = rnorm(100),
+   Chain = rep(1:2, each = 50),
+   part_chain = rep(c("full", "partial"), each = 50)
+ )
> # group passed outside aes()
> ggplot(
+   df,
+   aes(x = value, fill = part_chain, colour = part_chain),
+   group = Chain   
+ ) +
+   geom_density(alpha = 0.4)
Warning message:
In fortify(data, ...) :
  Arguments in `...` must be used.
✖ Problematic argument:
• group = Chain
ℹ Did you misspell an argument name?

This same code runs silently when group is passed inside of aes() as follows:

# group passed inside of aes() 
> ggplot( 
+   df, 
+   aes(x = value, fill = part_chain, colour = part_chain,  
+       group = Chain) 
+   ) + 
+   geom_density(alpha = 0.4)
>

  1. Deprecated size aesthetic

In the following reproducible example, the function ggs_rocplot() returns the following deprecation warning:

library(ggmcmc)  
data(binary)
  df = ggs(s.binary, family="mu")
  outcome = y.binary
  fig = ggs_rocplot(df, outcome)
Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
ℹ The deprecated feature was likely used in the ggmcmc package.
  Please report the issue at <https://github.com/xfim/ggmcmc/issues/>.

This is likely due to lines 53 and 57 in ggs_rocplot()'s source code:

 if (fully_bayesian) {
    # Start plotting
    f <- ggplot(roc.df, aes(x=1-Specificity, y=Sensitivity, group=as.factor(Iteration), color=as.factor(Chain))) +
      geom_step(alpha=0.4, size=0.4) + geom_rug(alpha=0.1, size=0.1, sides="b")
  } else {
    # Start plotting
    f <- ggplot(roc.df, aes(x=1-Specificity, y=Sensitivity, group=as.factor(Chain), color=as.factor(Chain))) +
      geom_step(alpha=0.4, size=1.2) + geom_rug(alpha=0.5, sides="b")
  }

This would likely be resolved by updating size to linewidth.

Both of the warnings are most likely due to the recent updates to the ggplot2 package, and do not appear to be functional issues with ggmcmc. However, updating the aesthetic placement and replacing the deprecated arguments will likely resolve these warnings.

Thank you for your time!

Morgan N.

P.S. Here is my session info:

R version 4.5.2 (2025-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Rocky Linux 9.7 (Blue Onyx)

Matrix products: default
BLAS:   /opt/R/openval/2026.03.00/4.5.2/lib64/R/lib/libRblas.so 
LAPACK: /opt/R/openval/2026.03.00/4.5.2/lib64/R/lib/libRlapack.so;  LAPACK version 3.12.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] testthat_3.3.1 ggmcmc_1.5.1.2 ggplot2_4.0.1  tidyr_1.3.1    dplyr_1.1.4   

loaded via a namespace (and not attached):
 [1] gtable_0.3.6       compiler_4.5.2     crayon_1.5.3       brio_1.1.5        
 [5] tidyselect_1.2.1   ggstats_0.11.0     vdiffr_1.0.8       scales_1.4.0      
 [9] lattice_0.22-7     coda_0.19-4.1      GGally_2.4.0       R6_2.6.1          
[13] labeling_0.4.3     generics_0.1.4     MASS_7.3-65        tibble_3.3.0      
[17] desc_1.4.3         rprojroot_2.1.1    pillar_1.11.1      RColorBrewer_1.1-3
[21] rlang_1.1.6        utf8_1.2.6         S7_0.2.1           pkgload_1.4.1     
[25] cli_3.6.5          withr_3.0.2        magrittr_2.0.4     grid_4.5.2        
[29] rstudioapi_0.17.1  lifecycle_1.0.4    waldo_0.6.2        vctrs_0.6.5       
[33] glue_1.8.0         farver_2.1.2       rsconnect_1.6.2    purrr_1.2.0       
[37] tools_4.5.2        pkgconfig_2.0.3   

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions