add_point | R Documentation |
Add an annotation point
add_point(
ax,
x,
y,
size = 5,
color = "#000",
fill = "#FFF",
width = 2,
shape = "circle",
radius = 2,
label = NULL,
...
)
ax |
An |
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: |
radius |
Radius of the marker (applies to square shape). |
label |
Add a label to the shade, use a |
... |
Additional arguments, see https://apexcharts.com/docs/options/annotations/ for possible options. |
An apexchart()
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]
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.