Skip to content

Commit 5e42da2

Browse files
committed
Fix #71
1 parent bd06392 commit 5e42da2

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* If image URLs doesn't indicate image format marquee will attempt to sniff it
66
* Fixes an S7 compatibility issue with merge_element (#83)
77
* marquee should no longer open a graphics device if none exists (#75)
8+
* `element_marquee()` now works with factor input and will fall back to
9+
`element_text()` for expressions (#71)
810

911
# marquee 1.1.0
1012

R/element_marquee.R

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,29 @@ element_grob.element_marquee <- function(
128128
if (is.null(label)) {
129129
return(ggplot2::zeroGrob())
130130
}
131+
if (is.expression(label)) {
132+
element$style <- NULL
133+
element$width <- NULL
134+
return(ggplot2::element_grob(
135+
inject(element_text(
136+
!!!element
137+
)),
138+
label,
139+
x = x,
140+
y = y,
141+
family = family,
142+
colour = colour,
143+
size = size,
144+
hjust = hjust,
145+
vjust = vjust,
146+
angle = angle,
147+
lineheight = lineheight,
148+
margin = margin,
149+
margin_x = margin_x,
150+
margin_y = margin_y
151+
))
152+
}
153+
label <- as.character(label)
131154
style <- style %||% element$style %||% classic_style()
132155
style <- modify_style(
133156
style,
@@ -341,4 +364,3 @@ rotate_just <- function(angle, hjust, vjust) {
341364
)
342365
)
343366
}
344-

0 commit comments

Comments
 (0)