Closed bklingen closed 3 years ago
I think annotations.texts
is used internally to place labels next to point/line annotations (see the appendTo
argument). If you just want to add text, the easiest way I think is to use a point and make it transparent, e.g. :
library(ggplot2)
library(apexcharter)
data("economics", package = "ggplot2")
apex(
data = tail(economics, 200),
mapping = aes(x = date, y = uempmed),
type = "line"
) %>%
add_event_marker(
when = "2007-03-01",
y = 15,
label = label("A Text Label", offsetX = 0, offsetY = 15),
color = "transparent",
fill = "transparent"
)
Wonderful, thanks! And for other plot types, one can just use add_point
with x
and y
coordinates and size=0
to add an invisible point plus a label.
Would it be possible to add something like an
add_text
to complementadd_vline
,add_hline
andadd_point
? It seems like the annotations definitions in apexchart allow for a text label:I tried with
ax_annotations (texts = list(list(...)))
, but to no avail: