add-vh-lines: Add horizontal or vertical line

Description Usage Arguments Value Examples

Description

Add horizontal or vertical line

Usage

1
2
3
add_hline(ax, value, color = "#000", dash = 0, label = NULL, ...)

add_vline(ax, value, color = "#000", dash = 0, label = NULL, ...)

Arguments

ax

An apexcharts htmlwidget object.

value

Vector of position for the line(s).

color

Color(s) of the line(s).

dash

Creates dashes in borders of SVG path. A higher number creates more space between dashes in the border. Use 0 for plain line.

label

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.

Value

An apexcharts htmlwidget object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
library(apexcharter)

# On a column chart
apex(
  data = table(unhcr_popstats_2017$continent_residence),
  aes(Var1, Freq),
  "column"
) %>% 
  add_hline(value = 2100)


# On a scatter chart
apex(
  data = iris,
  aes(Sepal.Length, Sepal.Width),
  "scatter"
) %>% 
  add_hline(value = mean(iris$Sepal.Width)) %>% 
  add_vline(value = mean(iris$Sepal.Length))

# With labels
apex(
  data = iris,
  aes(Sepal.Length, Sepal.Width),
  "scatter"
) %>% 
  add_hline(
    value = mean(iris$Sepal.Width),
    label = "Mean of Sepal.Width"
  ) %>% 
  add_vline(
    value = mean(iris$Sepal.Length),
    label = "Mean of Sepal.Length"
  )

apexcharter documentation built on May 11, 2021, 5:05 p.m.