Skip to content

Commit 2105a02

Browse files
committed
Alpha affects both fill and colour.
Fixes #1371
1 parent 233a11b commit 2105a02

6 files changed

+5
-11
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ All defunct functions have been removed.
154154
* Default margins scale with the theme font size, so the appearance at
155155
larger font sizes should be considerably improved (#1228).
156156

157+
* `alpha` now affects both fill and colour aesthetics (#1371).
158+
157159
* `element_text()` gains a margins argument which allows you to add additional
158160
padding around text elements. To help see what's going on use `debug = TRUE`
159161
to display the text region and anchors.

R/aes-colour-fill-alpha.r

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@
4444
#' h + geom_point(alpha = 0.5)
4545
#' h + geom_point(alpha = 1/10)
4646
#'
47-
#' #If a geom uses both fill and colour, alpha will only modify the fill colour
48-
#' c + geom_bar(fill = "dark grey", colour = "black")
49-
#' c + geom_bar(fill = "dark grey", colour = "black", alpha = 1/3)
50-
#'
5147
#' # Alpha can also be used to add shading
5248
#' j <- b + geom_line()
5349
#' j

R/geom-polygon.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ GeomPolygon <- ggproto("GeomPolygon", Geom,
8787
polygonGrob(munched$x, munched$y, default.units = "native",
8888
id = munched$group,
8989
gp = gpar(
90-
col = first_rows$colour,
90+
col = alpha(first_rows$colour, first_rows$alpha),
9191
fill = alpha(first_rows$fill, first_rows$alpha),
9292
lwd = first_rows$size * .pt,
9393
lty = first_rows$linetype

R/geom-rect.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ GeomRect <- ggproto("GeomRect", Geom,
5252
default.units = "native",
5353
just = c("left", "top"),
5454
gp = gpar(
55-
col = coords$colour,
55+
col = alpha(coords$colour, coords$alpha),
5656
fill = alpha(coords$fill, coords$alpha),
5757
lwd = coords$size * .pt,
5858
lty = coords$linetype,

R/geom-ribbon.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ GeomRibbon <- ggproto("GeomRibbon", Geom,
9292
default.units = "native",
9393
gp = gpar(
9494
fill = alpha(aes$fill, aes$alpha),
95-
col = aes$colour,
95+
col = alpha(aes$colour, aes$alpha),
9696
lwd = aes$size * .pt,
9797
lty = aes$linetype)
9898
))

man/aes_colour_fill_alpha.Rd

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)