Add an annotation point
Usage
add_point(
ax,
x,
y,
size = 5,
color = "#000",
fill = "#FFF",
width = 2,
shape = "circle",
radius = 2,
label = NULL,
...
)
Arguments
- ax
An
apexchart()
htmlwidget
object.- x
Coordinate(s) on the x-axis.
- y
Coordinate(s) on the y-axis.
- size
Size of the marker.
- color
Stroke Color of the marker point.
- fill
Fill Color of the marker point.
- width
Stroke Size of the marker point.
- shape
Shape of the marker:
"circle"
or"square"
.- radius
Radius of the marker (applies to square shape).
- label
Add a label to the shade, use a
character
or seelabel
for more controls.- ...
Additional arguments, see https://apexcharts.com/docs/options/annotations/ for possible options.
Value
An apexchart()
htmlwidget
object.
See also
add_event_marker
to add a point when x-axis is a datetime.
Examples
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]
)