Package 'shadowtext'

Title: 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.
Authors: Guangchuang Yu [aut, cre]
Maintainer: Guangchuang Yu <[email protected]>
License: Artistic-2.0
Version: 0.1.4
Built: 2024-11-15 05:22:13 UTC
Source: https://github.com/guangchuangyu/shadowtext

Help Index


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 black.

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')

GeomShadowText

Description

ShadowText Geom

Usage

GeomShadowText

Format

An object of class GeomShadowText (inherits from Geom, ggproto, gg) of length 7.

Author(s)

Guangchuang Yu


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