Add an annotation point
add_point(
ax,
x,
y,
size = 5,
color = "#000",
fill = "#FFF",
width = 2,
shape = "circle",
radius = 2,
label = NULL,
...
)
An apexcharts
htmlwidget
object.
Coordinate(s) on the x-axis.
Coordinate(s) on the y-axis.
Size of the marker.
Stroke Color of the marker point.
Fill Color of the marker point.
Stroke Size of the marker point.
Shape of the marker: "circle"
or "square"
.
Radius of the marker (applies to square shape).
Add a label to the shade, use a character
or see label
for more controls.
Additional arguments, see https://apexcharts.com/docs/options/annotations/ for possible options.
An apexcharts
htmlwidget
object.
add_event_marker
to add a point when x-axis is a datetime.
library(apexcharter)
# On scatter chart
apex(
data = iris,
aes(Sepal.Length, Sepal.Width),
"scatter"
) %>%
add_point(
x = mean(iris$Sepal.Length),
y = mean(iris$Sepal.Width)
)
# Some options
apex(
data = iris,
aes(Sepal.Length, Sepal.Width),
"scatter"
) %>%
add_point(
x = mean(iris$Sepal.Length),
y = mean(iris$Sepal.Width),
fill = "firebrick",
color = "firebrick",
size = 8,
label = label(text = "Mean", offsetY = 0)
)
# Several points
clusters <- kmeans(iris[, 1:2], 3)
apex(
data = iris,
aes(Sepal.Length, Sepal.Width),
"scatter"
) %>%
add_point(
x = clusters$centers[, 1],
y = clusters$centers[, 2]
)