Scale and modify axis.

gauge_axis(g2, var, ..., nice = TRUE, range = NULL, ticks = NULL,
  tick_count = NULL, tick_interval = NULL, min = NULL, max = NULL,
  type = NULL, formatter = NULL, sync = TRUE, values = NULL,
  base = NULL, exponent = NULL, mask = NULL, figure = NULL)

gauge_x_identity(g2, ..., figure = NULL)

gauge_y_identity(g2, ..., figure = NULL)

gauge_x_linear(g2, ..., nice = TRUE, range = NULL, ticks = NULL,
  tick_count = NULL, tick_interval = NULL, min = NULL, max = NULL,
  formatter = NULL, sync = TRUE, figure = NULL)

gauge_y_linear(g2, ..., nice = TRUE, range = NULL, ticks = NULL,
  tick_count = NULL, tick_interval = NULL, min = NULL, max = NULL,
  formatter = NULL, sync = TRUE, figure = NULL)

gauge_x_discrete(g2, ..., sync = TRUE, range = NULL,
  formatter = NULL, ticks = NULL, tick_count = NULL, values = NULL,
  figure = NULL)

gauge_y_discrete(g2, ..., sync = TRUE, range = NULL,
  formatter = NULL, ticks = NULL, tick_count = NULL, values = NULL,
  figure = NULL)

gauge_x_log(g2, ..., base = 2, nice = TRUE, sync = TRUE,
  formatter = NULL, ticks = NULL, tick_count = NULL,
  tick_interval = NULL, figure = NULL)

gauge_y_log(g2, ..., base = 2, nice = TRUE, sync = TRUE,
  formatter = NULL, ticks = NULL, tick_count = NULL,
  tick_interval = NULL, figure = NULL)

gauge_x_pow(g2, ..., exponent = 2, nice = TRUE, sync = TRUE,
  formatter = NULL, ticks = NULL, tick_count = NULL,
  tick_interval = NULL, figure = NULL)

gauge_y_pow(g2, ..., exponent = 2, nice = TRUE, sync = TRUE,
  formatter = NULL, ticks = NULL, tick_count = NULL,
  tick_interval = NULL, figure = NULL)

gauge_x_time(g2, ..., mask = NULL, nice = TRUE, sync = TRUE,
  formatter = NULL, ticks = NULL, tick_count = NULL,
  tick_interval = NULL, figure = NULL)

gauge_y_time(g2, ..., mask = NULL, nice = TRUE, sync = TRUE,
  formatter = NULL, ticks = NULL, tick_count = NULL,
  tick_interval = NULL, figure = NULL)

gauge_x_discrete_time(g2, ..., mask = NULL, nice = TRUE, sync = TRUE,
  formatter = NULL, ticks = NULL, tick_count = NULL, figure = NULL)

gauge_y_discrete_time(g2, ..., mask = NULL, nice = TRUE, sync = TRUE,
  formatter = NULL, ticks = NULL, tick_count = NULL, figure = NULL)

gauge_all_axis(g2, ...)

hide_axes(g2)

hide_axis(g2)

Arguments

g2

An object of class g2r as returned by g2r.

var

Variable to scale.

...

Configuration options or a logical indicating whether to show the axis.

nice

The default is TRUE, which is used to optimize the range of values so that the plotted axe is evenly distributed. For example, the range of raw data is c(3, 97), and if nice is true, the range of values is adjusted to c(0, 100].

range

The range of output data, defaults to c(0, 1).

ticks, tick_count, tick_interval

Number of ticks to show or interval between ticks, only one of those can be set.

min, max

Minimum and Maximum of axes.

type

Type of data plotted against the axis identity, linear, cat, time, timeCat, log, pow. See type section for details.

formatter

A callback function as returned by cb.

sync

Wehter to unify axes scales across planes.

values

Values of axes to use for categorical variables.

base, exponent

Used for type log and pow.

mask

Date time format.

figure

Name of figure to apply axis to, if NULL it is applied to all figures.

Type

  • identity: Constant.

  • linear: Continuous variable.

  • cat: Categorical variable.

  • time: Continous time variable.

  • timeCat: Non-continuous time variable.

  • log: Logarithmic data.

  • pow: Exponential data.

Examples

g <- g2(cars, asp(speed, dist)) %>% fig_point() g %>% gauge_x_linear(min = 0) g %>% gauge_y_log(title = "Log") g %>% gauge_x_linear(tick_count = 4)