Title: | Shadow Text Grob and Layer |
Version: | 0.1.5 |
Description: | Implement shadowtextGrob() for 'grid' and geom_shadowtext() layer for 'ggplot2'. These functions create/draw text grob with background shadow. |
Depends: | R (≥ 3.4.0) |
Imports: | ggplot2, grid, scales, S7 |
Suggests: | knitr, rmarkdown, prettydoc |
VignetteBuilder: | knitr |
License: | Artistic-2.0 |
Encoding: | UTF-8 |
URL: | https://github.com/GuangchuangYu/shadowtext/ |
BugReports: | https://github.com/GuangchuangYu/shadowtext/issues |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-06-30 09:21:06 UTC; HUAWEI |
Author: | Guangchuang Yu [aut, cre] |
Maintainer: | Guangchuang Yu <guangchuangyu@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2025-06-30 16:40:02 UTC |
shadowtext: Shadow Text Grob and Layer
Description
Implement shadowtextGrob() for 'grid' and geom_shadowtext() layer for 'ggplot2'. These functions create/draw text grob with background shadow.
Author(s)
Maintainer: Guangchuang Yu guangchuangyu@gmail.com
See Also
Useful links:
Report bugs at https://github.com/GuangchuangYu/shadowtext/issues
GeomShadowText
Description
ShadowText Geom
Usage
GeomShadowText
Format
An object of class GeomShadowText
(inherits from Geom
, ggproto
, gg
) of length 7.
Author(s)
Guangchuang Yu
element_shadowtext
Description
shadown text element for ggplot theme system
Usage
element_shadowtext(
family = NULL,
face = NULL,
colour = NULL,
size = NULL,
hjust = NULL,
vjust = NULL,
angle = NULL,
lineheight = NULL,
color = NULL,
margin = NULL,
debug = NULL,
bg.colour = "black",
bg.color = NULL,
bg.r = 0.1,
inherit.blank = FALSE
)
Arguments
family |
Font family |
face |
Font face ("plain", "italic", "bold", "bold.italic") |
colour |
text colour |
size |
text size in pts |
hjust |
horizontal justification (in [0, 1]) |
vjust |
vertical justification (in [0, 1]) |
angle |
text angle |
lineheight |
line height |
color |
aliase to colour |
margin |
margins around the text, see also 'margin()' for more details |
debug |
if 'TRUE', aids visual debugging by drawing a solic rectangle behind the complete text area, and a point where each label is anchored. |
bg.colour |
the background colour of text, default is |
bg.color |
the alias of bg.colour, |
bg.r |
background ratio of shadow text. |
inherit.blank |
whether inherit 'element_blank' |
Value
element_shadowtext object
Author(s)
Guangchuang Yu and xmarti6@github
geom_shadowtext
Description
a shadow version of geom_text
Usage
geom_shadowtext(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
parse = FALSE,
nudge_x = 0,
nudge_y = 0,
check_overlap = FALSE,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
Arguments
mapping |
aesthetic mapping |
data |
the data to be displayed |
stat |
statistical transformation |
position |
position adjustment |
... |
additional parameter |
parse |
whether parse text as expression |
nudge_x |
horizontal adjustment of text |
nudge_y |
vertical adjustment of text |
check_overlap |
whether check overlap |
na.rm |
whether remove NA values |
show.legend |
whether show legend |
inherit.aes |
whether inherit aes from ggplot |
Value
layer
Author(s)
guangchuang yu
Examples
library(ggplot2)
d <- data.frame(x = rnorm(3), y=rnorm(3), label = c('hello', 'world', '!!!'))
ggplot(d, aes(x,y)) + geom_shadowtext(aes(label=label, color=label), bg.colour='firebrick')
Objects exported from other packages
Description
These objects are imported from other packages. Follow the links below to see their documentation.
- grid
shadowtextGrob
Description
create and draw text
Usage
shadowtextGrob(
label,
x = unit(0.5, "npc"),
y = unit(0.5, "npc"),
just = "centre",
hjust = NULL,
vjust = NULL,
rot = 0,
check.overlap = FALSE,
default.units = "npc",
name = NULL,
gp = gpar(col = "white"),
vp = NULL,
bg.colour = "black",
bg.r = 0.1
)
grid.shadowtext(
label,
x = unit(0.5, "npc"),
y = unit(0.5, "npc"),
just = "centre",
hjust = NULL,
vjust = NULL,
rot = 0,
check.overlap = FALSE,
default.units = "npc",
name = NULL,
gp = gpar(col = "white"),
vp = NULL,
bg.colour = "black",
bg.r = 0.1,
draw = TRUE
)
Arguments
label |
text labels |
x |
x position |
y |
y position |
just |
The justification of the text, can be 'left', 'right', 'center', 'bottom' and 'top' |
hjust |
horizontal adjustment |
vjust |
vertical adjustment |
rot |
angle to rotate the text |
check.overlap |
whether check for and omit overlapping text |
default.units |
default unit of x and y |
name |
identifier |
gp |
gpar object |
vp |
viewport object |
bg.colour |
background color of shadow text |
bg.r |
background ratio of shadow text |
draw |
whether draw the grob |
Value
grob object
Author(s)
guangchuang yu