Update y axis range in a Bokeh figure

Share:

Description

Update y axis range in a Bokeh figure

Usage

1
y_range(fig, dat = NULL, callback = NULL)

Arguments

fig

figure to modify

dat

either a vector (min, max) if the axis is numeric, or a vector of values if the axis is categorical. In the latter case, the order in which the values are supplied is how they will be arranged on the axis.

callback

TODO

See Also

Other ranges: x_range

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# get data from Duluth site in 'barley' data
du <- subset(lattice::barley, site == "Duluth")

# plot with default ranges
p <- figure(width = 600) %>%
  ly_points(yield, variety, color = year, data = du)
p
# y axis is alphabetical

# manually set x and y axis (y in order of 1932 yield)
p %>%
  x_range(c(20, 40)) %>%
  y_range(du$variety[order(subset(du, year == 1932)$yield)])

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.