From b2c79fdfbabf30a270309e81dbc8beb134df2a83 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 13 Nov 2025 13:28:51 +0000 Subject: [PATCH] Respect out1.gpar and out2.gpar parameters in ggdesplot Previously, outline colors and line widths were hardcoded, ignoring user-provided out1.gpar and out2.gpar parameters. This fix extracts color, line width (lwd), and line type (lty) from the gpar lists and applies them to the outline borders. Additionally, this fixes a bug where the hardcoded values didn't match the documented defaults (e.g., out1 default lwd=3 was being rendered as lwd=1.5). Now users can customize outline appearance as documented, for example: out1.gpar=list(col="red", lwd=2, lty=2) out2.gpar=list(col="blue", lwd=0.5, lty=1) --- R/ggdesplot.R | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/R/ggdesplot.R b/R/ggdesplot.R index 43187ff..d418dd2 100644 --- a/R/ggdesplot.R +++ b/R/ggdesplot.R @@ -463,16 +463,21 @@ ggdesplot <- function(data, scale_fill_manual(values=col.regions) if(has.out1) - out <- out + + out <- out + #geom_tileborder(aes_string(group=1, grp=out1.string), geom_tileborder(aes(group=1, grp=.data[[out1.string]]), - lineend="round", color="black", lwd=1.5) - + lineend="round", + color=out1.gpar$col, + lwd=out1.gpar$lwd, + linetype=if(is.null(out1.gpar$lty)) 1 else out1.gpar$lty) + if(has.out2) - out <- out + - #geom_tileborder(aes_string(group=1, grp=out2.string), + out <- out + + #geom_tileborder(aes_string(group=1, grp=out2.string), geom_tileborder(aes(group=1, grp=.data[[out2.string]]), - color="yellow", lwd=0.5) + color=out2.gpar$col, + lwd=out2.gpar$lwd, + linetype=if(is.null(out2.gpar$lty)) 1 else out2.gpar$lty) # use '4*cex' so that cex in lattice/ggplot2 is roughly the same size if(has.text|has.num|has.col) # cell text #out = out + geom_text(aes_string(x.string, y.string,