Skip to content
Merged
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ small selection of feature refinements.

* ggplot2 now requires R >= 3.3 (#4247).

* The `ticks.linewidth` and `frame.linewidth` parameters of `guide_colourbar()`
are now multiplied with `.pt` like elsewhere in ggplot2. It can cause visual
changes when these arguments are not the defaults and these changes can be
restored to their previous behaviour by adding `/ .pt` (@teunbrand #4314).

* ggplot2 now uses `rlang::check_installed()` to check if a suggested package is
installed, which will offer to install the package before continuing (#4375,
@malcolmbarrett)
Expand Down
8 changes: 4 additions & 4 deletions R/guide-colorbar.r
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ guide_colourbar <- function(

# frame
frame.colour = NULL,
frame.linewidth = 0.5,
frame.linewidth = 0.5 / .pt,
frame.linetype = 1,

# ticks
ticks = TRUE,
ticks.colour = "white",
ticks.linewidth = 0.5,
ticks.linewidth = 0.5 / .pt,
draw.ulim= TRUE,
draw.llim = TRUE,

Expand Down Expand Up @@ -322,7 +322,7 @@ guide_gengrob.colorbar <- function(guide, theme) {
default.units = "cm",
gp = gpar(
col = guide$frame.colour,
lwd = guide$frame.linewidth,
lwd = guide$frame.linewidth * .pt,
lty = guide$frame.linetype,
fill = NA)
)
Expand Down Expand Up @@ -451,7 +451,7 @@ guide_gengrob.colorbar <- function(guide, theme) {
default.units = "cm",
gp = gpar(
col = guide$ticks.colour,
lwd = guide$ticks.linewidth,
lwd = guide$ticks.linewidth * .pt,
lineend = "butt"
)
)
Expand Down
8 changes: 4 additions & 4 deletions man/guide_colourbar.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test-guides.R
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ test_that("colorbar can be styled", {
low = 'white', high = 'red',
guide = guide_colorbar(
frame.colour = "green",
frame.linewidth = 1.5,
frame.linewidth = 1.5 / .pt,
ticks.colour = "black",
ticks.linewidth = 2.5
ticks.linewidth = 2.5 / .pt
)
)
)
Expand Down