Skip to content

Commit 344e40f

Browse files
authored
feat: Support grid::pattern() / gradient fills (#98)
* feat: Support 'grid::pattern()' / gradient fills * Bumps required {ggplot2} to v3.5.0 when `fill_alpha()` was introduced. * Replace each `fill = alpha(fill, alpha)` with `fill = fill_alpha(fill, alpha)`. closes #94 * docs(NEWS.md): Add entry for pattern fill feature
1 parent a8a9982 commit 344e40f

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ BugReports: https://github.com/wilkelab/ggridges/issues
1616
Depends:
1717
R (>= 3.2)
1818
Imports:
19-
ggplot2 (>= 3.4.0),
19+
ggplot2 (>= 3.5.0),
2020
grid (>= 3.0.0),
2121
scales (>= 0.4.1),
2222
withr (>= 2.1.1)

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ ggridges 0.5.6.9000
22
----------------------------------------------------------------
33
- Add support for weighted density estimates in `stat_density_ridges()` by
44
allowing the use of the `weight` aesthetic (@joranE, #90)
5+
- Add support for `grid::pattern()`, `grid::linearGradient()`, and `grid::radialGradient()` values for `fill` and `point_fill` aesthetics
6+
by using [`ggplot2::fill_alpha()`](https://ggplot2.tidyverse.org/reference/fill_alpha.html) (@trevorld, #94)
57

68
ggridges 0.5.6
79
----------------------------------------------------------------

R/geoms-gradient.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ GeomRidgelineGradient <- ggproto("GeomRidgelineGradient", Geom,
164164
data$point_colour %||% data$point_color %||% data$colour,
165165
data$point_alpha %||% data$alpha
166166
),
167-
fill = alpha(
167+
fill = ggplot2::fill_alpha(
168168
data$point_fill %||% data$fill,
169169
data$point_alpha %||% data$alpha
170170
),
@@ -303,7 +303,7 @@ GeomRidgelineGradient <- ggproto("GeomRidgelineGradient", Geom,
303303
data$point_colour %||% data$point_color %||% data$colour,
304304
data$point_alpha %||% data$alpha
305305
),
306-
fill = alpha(
306+
fill = ggplot2::fill_alpha(
307307
data$point_fill %||% data$fill,
308308
data$point_alpha %||% data$alpha
309309
),

R/geoms.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ GeomRidgeline <- ggproto("GeomRidgeline", Geom,
157157
height = grid::unit(1, "npc") - grid::unit(lwd, "mm"),
158158
gp = grid::gpar(
159159
col = data$colour,
160-
fill = alpha(data$fill, data$alpha),
160+
fill = ggplot2::fill_alpha(data$fill, data$alpha),
161161
lty = data$linetype,
162162
lwd = lwd * .pt,
163163
linejoin = "mitre"
@@ -191,7 +191,7 @@ GeomRidgeline <- ggproto("GeomRidgeline", Geom,
191191
data$point_colour %||% data$point_color %||% data$colour,
192192
data$point_alpha %||% data$alpha
193193
),
194-
fill = alpha(
194+
fill = ggplot2::fill_alpha(
195195
data$point_fill %||% data$fill,
196196
data$point_alpha %||% data$alpha
197197
),
@@ -304,7 +304,7 @@ GeomRidgeline <- ggproto("GeomRidgeline", Geom,
304304
data$point_colour %||% data$point_color %||% data$colour,
305305
data$point_alpha %||% data$alpha
306306
),
307-
fill = alpha(
307+
fill = ggplot2::fill_alpha(
308308
data$point_fill %||% data$fill,
309309
data$point_alpha %||% data$alpha
310310
),
@@ -355,7 +355,7 @@ GeomRidgeline <- ggproto("GeomRidgeline", Geom,
355355
munched_poly$x, munched_poly$y, id = munched_poly$id,
356356
default.units = "native",
357357
gp = grid::gpar(
358-
fill = ggplot2::alpha(aes$fill, aes$alpha),
358+
fill = ggplot2::fill_alpha(aes$fill, aes$alpha),
359359
lty = 0)
360360
)
361361
)
@@ -591,7 +591,7 @@ GeomDensityRidges2 <- ggproto("GeomDensityRidges2", GeomDensityRidges,
591591
munched_poly$x, munched_poly$y, id = munched_poly$id,
592592
default.units = "native",
593593
gp = grid::gpar(
594-
fill = ggplot2::alpha(aes$fill, aes$alpha),
594+
fill = ggplot2::fill_alpha(aes$fill, aes$alpha),
595595
col = aes$colour,
596596
lwd = aes$linewidth * .pt,
597597
lty = aes$linetype)

R/geomsv.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ GeomVRidgeline <- ggproto("GeomVRidgeline", Geom,
207207
munched_poly$x, munched_poly$y, id = munched_poly$id,
208208
default.units = "native",
209209
gp = grid::gpar(
210-
fill = ggplot2::alpha(aes$fill, aes$alpha),
210+
fill = ggplot2::fill_alpha(aes$fill, aes$alpha),
211211
lty = 0)
212212
))
213213
grid::grobTree(ag, lg)

0 commit comments

Comments
 (0)