Learn R Programming

apexcharter (version 0.4.4)

ax_grid: Add grids on chart

Description

Add grids on chart

Usage

ax_grid(
  ax,
  show = NULL,
  borderColor = NULL,
  strokeDashArray = NULL,
  position = NULL,
  xaxis = NULL,
  yaxis = NULL,
  row = NULL,
  column = NULL,
  padding = NULL,
  ...
)

Value

An apexchart()

htmlwidget object.

Arguments

ax

An apexchart() htmlwidget object.

show

Logical. To show or hide grid area (including xaxis / yaxis)

borderColor

Colors of grid borders / lines.

strokeDashArray

Creates dashes in borders of svg path. Higher number creates more space between dashes in the border.

position

Whether to place grid behind chart paths of in front. Available options for position: "front" or "back"

xaxis

A list of parameters.

yaxis

A list of parameters.

row

A list of parameters.

column

A list of parameters.

padding

A list of parameters.

...

Additional parameters.

Examples

Run this code
data("mpg", package = "ggplot2")

# Hide Y-axis and gridelines
apex(
  data = mpg,
  mapping = aes(x = manufacturer)
) %>% 
  ax_grid(show = FALSE)

# just grid lines
apex(
  data = mpg,
  mapping = aes(x = manufacturer)
) %>% 
  ax_grid(yaxis = list(lines = list(show = FALSE)))


# both x & y
data("economics", package = "ggplot2")
apex(
  data = economics,
  mapping = aes(x = date, y = psavert),
  type = "line"
) %>% 
  ax_grid(
    yaxis = list(lines = list(show = TRUE)),
    xaxis = list(lines = list(show = TRUE))
  )

Run the code above in your browser using DataLab