# Labs: title, subtitle & axis

Packages and data used below:

    library(apexcharter)
    library(dplyr)

    data("diamonds", package = "ggplot2")
    n_cut <- dplyr::count(diamonds, cut)

## Chart title

    apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>%
      ax_title(text = "Cut distribution")

You can set some options, for example:

    apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>%
      ax_title(
        text = "Cut distribution",
        align = "center",
        style = list(fontSize = "22px")
      )

Full list of parameters is available here : https://apexcharts.com/docs/options/title/

## Chart subtitle

    apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>%
      ax_title(text = "Cut distribution") %>%
      ax_subtitle(text = "Data from ggplot2")

With same options than for title:

    apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>%
      ax_title(
        text = "Cut distribution",
        align = "center",
        style = list(fontSize = "22px")
      ) %>%
      ax_subtitle(
        text = "Data from ggplot2",
        align = "center",
        style = list(fontSize = "16px", color = "#BDBDBD")
      )

Full list of parameters is available here : https://apexcharts.com/docs/options/subtitle/

## Axis title

    apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>%
      ax_yaxis(title = list(text = "Count")) %>%
      ax_xaxis(title = list(text = "Cut"))

With some options:

    apex(data = n_cut, type = "column", mapping = aes(x = cut, y = n)) %>%
      ax_yaxis(title = list(
        text = "Count",
        style = list(fontSize = "14px", color = "#BDBDBD")
      )) %>%
      ax_xaxis(title = list(
        text = "Cut",
        style = list(fontSize = "14px", color = "#BDBDBD")
      ))