axis: Axis

e_axisR Documentation

Axis

Description

Customise axis.

Usage

e_axis(
  e,
  serie,
  axis = c("x", "y", "z"),
  index = 0,
  formatter = NULL,
  margin = 0,
  ...
)

e_axis_(
  e,
  serie = NULL,
  axis = c("x", "y", "z"),
  index = 0,
  formatter = NULL,
  margin = 0,
  ...
)

e_x_axis_(e, serie = NULL, index = 0, formatter = NULL, margin = 0, ...)

e_y_axis_(e, serie = NULL, index = 0, formatter = NULL, margin = 0, ...)

e_z_axis_(e, serie = NULL, index = 0, margin = 0, ...)

e_x_axis(e, serie, index = 0, formatter = NULL, margin = 0, ...)

e_y_axis(e, serie, index = 0, formatter = NULL, margin = 0, ...)

e_z_axis(e, serie, index = 0, margin = 0, ...)

e_rm_axis(e, axis = c("x", "y", "z"))

e_axis_formatter(
  style = c("decimal", "percent", "currency"),
  digits = 0,
  locale = NULL,
  currency = "USD"
)

Arguments

e

An echarts4r object as returned by e_charts or a proxy as returned by echarts4rProxy.

serie

Column name of serie to range the axis. If used the range of the serie is used as, min an max.

axis

Axis to customise.

index

Index of axis to customise.

formatter

An axis formatter as returned by e_axis_formatter.

margin

Margin to apply to serie: min = serie - margin and max = serie + margin

...

Any other option to pass, check See Also section.

style

Formatter style, one of decimal, percent, or currency.

digits

Number of decimals.

locale

Locale, if NULL then it is inferred from Sys.getlocale.

currency

Currency to to display.

Details

The e_axis_formatter may not work in RStudio, open the plot in your browser. It will display just fine in Rmarkdown and Shiny.

Functions

  • e_axis to customise axis

  • e_rm_axis to remove axis

See Also

Additional x arguments, Additional y arguments

Examples

# range axis based on serie
cars |>
  e_charts(speed) |>
  e_line(dist) |>
  e_x_axis(speed) |>
  e_y_axis(dist)

# use formatter
cars |>
  dplyr::mutate(
    speed = speed / 25
  ) |>
  e_charts(speed) |>
  e_scatter(dist) |>
  e_y_axis(
    formatter = e_axis_formatter("currency")
  ) |>
  e_x_axis(
    formatter = e_axis_formatter("percent", digits = 0)
  )

# plot all labels & rotate
USArrests |>
  head(10) |>
  tibble::rownames_to_column(var = "State") |> 
  e_charts(State) |>
  e_area(Murder) |>
  e_x_axis(axisLabel = list(interval = 0, rotate = 45)) # rotate

JohnCoene/echarts4r documentation built on Feb. 23, 2024, 9:21 a.m.