Customize x axis of a Bokeh figure

x_axis(
  fig,
  label,
  position = "below",
  log = FALSE,
  grid = TRUE,
  desired_num_ticks = NULL,
  num_minor_ticks = 5,
  visible = TRUE,
  number_formatter = c("basic", "numeral", "printf"),
  power_limit_high = 5,
  power_limit_low = -3,
  precision = NULL,
  use_scientific = TRUE,
  format = NULL
)

Arguments

fig

figure to modify

label

axis label

position

where to place the axis (either "above" or "below")

log

logical or integer - if TRUE, a log axis with base 10 is used - if an integer, a log axis with base of that integer will be used

grid

logical - should a reference grid be shown for this axis?

desired_num_ticks

desired target number of major tick positions to generate across the plot range

num_minor_ticks

number of minor ticks

visible

should axis be shown?

number_formatter

Bokeh numeric tick label formatter ("basic", "numeral", or "printf"); ignored if log is TRUE

power_limit_high

(int) Limit the use of scientific notation to when log(x) >= value. Only applicable when number_formatter is "basic".

power_limit_low

(int) Limit the use of scientific notation to when log(x) <= value. Only applicable when number_formatter is "basic".

precision

(int) How many digits of precision to display in tick labels. Automatically determined if not specified. Only applicable when number_formatter is "basic".

use_scientific

(logical) Whether to ever display scientific notation. If True, then when to use scientific notation is controlled by power_limit_low and power_limit_high. Only applicable when number_formatter is "basic".

format

Specification of format options. Specification depends on the value of number_formatter - see "details" below.

Details

format parameter: When number_formatter is "basic" and the axis type is datetime, format specifies how to display tick values from a continuous range as formatted datetimes. See DatetimeTickFormatter When number_formatter is "numeral", format specifies a human-readable format string. See NumeralTickFormatter. When number_formatter is "printf", format is a printf-style format string. See PrintfTickFormatter.

See also

Other axes: y_axis()

Examples

figure() %>% ly_points(rexp(1000), rexp(1000)) %>% x_axis(label = "x", log = TRUE) %>% y_axis(label = "y", log = TRUE) figure() %>% ly_points(2 ^ (1:10)) %>% y_axis(log = 2) # disable scientific tick labels figure() %>% ly_points(rnorm(10), rnorm(10) / 1000) %>% y_axis(use_scientific = FALSE) # specify datetime tick labels # the appropriate datetime units are automatically chosen big_range <- seq(as.Date("2012-01-01"), as.Date("2012-12-31"), by = "days") small_range <- seq(as.Date("2012-01-01"), as.Date("2012-02-01"), by = "days") figure() %>% ly_lines(big_range, rnorm(366)) %>% x_axis(label = "Date", format = list(months = "%b-%Y", days = "%d")) figure() %>% ly_lines(small_range, rnorm(32)) %>% x_axis(label = "Date", format = list(months = "%b-%Y", days = "%d")) # specify numeric tick labels figure() %>% ly_points(rnorm(10), rnorm(10) * 10000) %>% y_axis(number_formatter = "numeral", format = "0,000") figure() %>% ly_points(rnorm(10), rnorm(10) * 100) %>% y_axis(number_formatter = "printf", format = "%0.1f%%")