diff --git a/NEWS.md b/NEWS.md index 0a586921..af986d7d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,11 @@ where the formatting is also better._ ## Development version +### Aesthetic changes + +- The legend plot characters for the `"pointrange"` and `"errorbar"` types now + include a line, to better resemble the actual plot elements (#532 @grantmcdermott) + ### Internals - We now encourage type-specific legend customizations within the individual diff --git a/R/type_pointrange.R b/R/type_pointrange.R index c98b61d5..967020ac 100644 --- a/R/type_pointrange.R +++ b/R/type_pointrange.R @@ -49,7 +49,7 @@ draw_pointrange = function() { data_pointrange = function(dodge, fixed.dodge) { fun = function(settings, ...) { - env2env(settings, environment(), c("datapoints", "xlabs", "cex")) + env2env(settings, environment(), c("datapoints", "xlabs", "cex", "lty", "lwd")) if (is.character(datapoints$x)) { datapoints$x = as.factor(datapoints$x) @@ -74,6 +74,8 @@ data_pointrange = function(dodge, fixed.dodge) { # legend customizations settings$legend_args[["pt.cex"]] = settings$legend_args[["pt.cex"]] %||% (cex %||% par("cex")) + settings$legend_args[["lty"]] = settings$legend_args[["lty"]] %||% (lty %||% par("lty")) + settings$legend_args[["lwd"]] = settings$legend_args[["lwd"]] %||% (lwd %||% par("lwd")) env2env(environment(), settings, c( "x", diff --git a/inst/tinytest/_tinysnapshot/dodge_errorbar_add_lines.svg b/inst/tinytest/_tinysnapshot/dodge_errorbar_add_lines.svg index a096a87a..d1d7be1d 100644 --- a/inst/tinytest/_tinysnapshot/dodge_errorbar_add_lines.svg +++ b/inst/tinytest/_tinysnapshot/dodge_errorbar_add_lines.svg @@ -26,33 +26,36 @@ - - - -model -Model A -Model B -Model C + + + + + + +model +Model A +Model B +Model C - - + + - -term + +term estimate - - - - - -(Intercept) -wt -cyl -hp + + + + + +(Intercept) +wt +cyl +hp @@ -64,65 +67,65 @@ 20 30 40 - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inst/tinytest/_tinysnapshot/dodge_errorbar_add_ribbon.svg b/inst/tinytest/_tinysnapshot/dodge_errorbar_add_ribbon.svg index d72f004a..e7a31d7f 100644 --- a/inst/tinytest/_tinysnapshot/dodge_errorbar_add_ribbon.svg +++ b/inst/tinytest/_tinysnapshot/dodge_errorbar_add_ribbon.svg @@ -26,33 +26,36 @@ - - - -model -Model A -Model B -Model C + + + + + + +model +Model A +Model B +Model C - - + + - -term + +term estimate - - - - - -(Intercept) -wt -cyl -hp + + + + + +(Intercept) +wt +cyl +hp @@ -64,68 +67,68 @@ 20 30 40 - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inst/tinytest/_tinysnapshot/dodge_pointrange.svg b/inst/tinytest/_tinysnapshot/dodge_pointrange.svg index fd930a5c..fdacb047 100644 --- a/inst/tinytest/_tinysnapshot/dodge_pointrange.svg +++ b/inst/tinytest/_tinysnapshot/dodge_pointrange.svg @@ -26,33 +26,36 @@ - - - -model -Model A -Model B -Model C + + + + + + +model +Model A +Model B +Model C - - + + - -term + +term estimate - - - - - -(Intercept) -wt -cyl -hp + + + + + +(Intercept) +wt +cyl +hp @@ -64,44 +67,44 @@ 20 30 40 - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inst/tinytest/_tinysnapshot/dodge_pointrange_false.svg b/inst/tinytest/_tinysnapshot/dodge_pointrange_false.svg index c177c2d4..7526a50d 100644 --- a/inst/tinytest/_tinysnapshot/dodge_pointrange_false.svg +++ b/inst/tinytest/_tinysnapshot/dodge_pointrange_false.svg @@ -26,33 +26,36 @@ - - - -model -Model A -Model B -Model C + + + + + + +model +Model A +Model B +Model C - - + + - -term + +term estimate - - - - - -(Intercept) -wt -cyl -hp + + + + + +(Intercept) +wt +cyl +hp @@ -64,44 +67,44 @@ 20 30 40 - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inst/tinytest/_tinysnapshot/dodge_pointrange_flip.svg b/inst/tinytest/_tinysnapshot/dodge_pointrange_flip.svg index 9f4b7efa..03a80c14 100644 --- a/inst/tinytest/_tinysnapshot/dodge_pointrange_flip.svg +++ b/inst/tinytest/_tinysnapshot/dodge_pointrange_flip.svg @@ -26,35 +26,38 @@ - - - -model -Model A -Model B -Model C + + + + + + +model +Model A +Model B +Model C - - + + - -estimate + +estimate term - - - - - - -0 -10 -20 -30 -40 + + + + + + +0 +10 +20 +30 +40 @@ -64,44 +67,44 @@ wt cyl hp - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inst/tinytest/_tinysnapshot/dodge_pointrange_true.svg b/inst/tinytest/_tinysnapshot/dodge_pointrange_true.svg index 52a11a5f..ca58cb3a 100644 --- a/inst/tinytest/_tinysnapshot/dodge_pointrange_true.svg +++ b/inst/tinytest/_tinysnapshot/dodge_pointrange_true.svg @@ -26,33 +26,36 @@ - - - -model -Model A -Model B -Model C + + + + + + +model +Model A +Model B +Model C - - + + - -term + +term estimate - - - - - -(Intercept) -wt -cyl -hp + + + + + +(Intercept) +wt +cyl +hp @@ -64,44 +67,44 @@ 20 30 40 - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +