Gauge the variables (aspects) used to define axis and grid of the plot.

gauge(
  g,
  asp,
  ...,
  nice = TRUE,
  range = NULL,
  min = NULL,
  max = NULL,
  min_limit = NULL,
  max_limit = NULL,
  alias = NULL,
  tick_count = NULL,
  max_tick_count = NULL
)

gauge_x_time(g, ..., show_last = FALSE)

gauge_y_time(g, ..., show_last = FALSE)

gauge_x_linear(g, ..., tick_interval = NULL)

gauge_y_linear(g, ..., tick_interval = NULL)

gauge_x_cat(g, ...)

gauge_y_cat(g, ...)

gauge_x_time_cat(g, ...)

gauge_y_time_cat(g, ...)

gauge_x_log(g, ..., base = 10)

gauge_y_log(g, ..., base = 10)

gauge_x_pow(g, ...)

gauge_y_pow(g, ...)

gauge_x_quantile(g, ...)

gauge_y_quantile(g, ...)

gauge_x_quantize(g, ...)

gauge_y_quantize(g, ...)

gauge_x_identity(g, ...)

gauge_y_identity(g, ...)

gauge_asp(g, ...)

Arguments

g

An object of class g2r or g2Proxy as returned by g2() or g2_proxy().

asp

Bare column name of aspect to apply the gauge to.

...

Options to gauge variables (aspects defined by asp()).

nice

Automatically adjust min, and max.

range

A vector of length 2 giving the minimum, and maximum.

min, max

Range of the gauge.

min_limit, max_limit

Strict range of the ticks.

alias

Alias name of the gauge and variable to display.

tick_count

Maximum number of ticks.

max_tick_count

Maximum number of ticks.

show_last

Whether to force show the last tick (only for time gauges).

tick_interval

Minimum tick interval, only applies to linear type of gauge.

base

Base of log.

Types

  • cat: Categorical.

  • timeCat: Categorical time.

  • linear: Linear.

  • time: Date, time, etc.

  • log: Logarithmic.

  • pow: Exponential.

  • quantize: Manual quantiles.

  • quantile: Auto-generated quantiles.

  • identity: Constant.

Examples

g <- g2(cars, asp(speed, dist)) %>%
  fig_point()

g %>% gauge(speed, min = 0)
g %>% gauge_y_log(title = "Log")
g %>% gauge(dist, tickCount = 10)