Initialize a Bokeh figure

  data = NULL,
  width = NULL,
  height = NULL,
  title = NULL,
  xlab = NULL,
  ylab = NULL,
  xlim = NULL,
  ylim = NULL,
  padding_factor = 0.07,
  xgrid = TRUE,
  ygrid = TRUE,
  xaxes = "below",
  yaxes = "left",
  legend_location = "top_right",
  tools = c("pan", "wheel_zoom", "box_zoom", "reset", "save", "help"),
  theme = getOption("bokeh_theme"),
  toolbar_location = "above",
  h_symmetry = TRUE,
  v_symmetry = FALSE,
  logo = NULL,
  lod_factor = 10,
  lod_interval = 300,
  lod_threshold = NULL,
  lod_timeout = 500,
  webgl = FALSE,



data to be supplied to all layers, if the layer doesn't supply a data value


figure width in pixels


figure width in pixels


a title to display above the plot. - "title" is also the prefix for a set of Text Properties, so you can set the font for the title with the parameter text_font.


label for x axis


label for y axis


the extent of the plotting area in the x-dimension (will be computed automatically if not specified).


the extent of the plotting area in the y-dimension (will be computed automatically if not specified).


if limits are not specified, by what factor should the extents of the data be padded


whether to draw x axis grid lines


whether to draw y axis grid lines


where to put x axis, or FALSE if no x axis ticks / labels


where to put y axis, or FALSE if no y axis ticks / labels


('top_right', 'top_left', 'bottom_left', 'bottom_right') the location where the legend should draw itself, or NULL to omit the legend


character vector of interactivity tools options (acceptable values are: "pan", "wheel_zoom", "box_zoom", "resize", "crosshair", "box_select", "lasso_select", "reset", "save", "help"). Additionally, tool functions can be called on a figure to specify more control - see the "See Also" section below for a list of tool functions. If NULL, the toolbar will not be drawn. If "" the toolbar will be drawn but no tools will be added by default.


an rbokeh theme to use


('above', 'below', 'left', 'right') Where the toolbar will be located. If set to NULL, no toolbar will be attached to the plot.


(logical) Whether the total horizontal padding on both sides of the plot will be made equal (the left or right padding amount, whichever is larger).


(logical) Whether the total vertical padding on both sides of the plot will be made equal (the top or bottom padding amount, whichever is larger).


('normal', 'grey') What version of the Bokeh logo to display on the toolbar. If set to NULL, no logo will be displayed.


(integer) Decimation factor to use when applying level-of-detail decimation (see "Controlling level of detail").


(integer) Interval (in ms) during which an interactive tool event will enable level-of-detail downsampling (see "Controlling level of detail").


(integer) A number of data points, above which level-of-detail downsampling may be performed by glyph renderers. Set to NULL to disable any level-of-detail downsampling (see "Controlling level of detail").


(integer) Timeout (in ms) for checking whether interactive tool events are still occurring. Once level-of-detail mode is enabled, a check is made every lod_timeout ms. If no interactive tool events have happened, level-of-detail mode is disabled (see "Controlling level of detail").


(logical) should webgl be used for rendering?


parameters can be specified here that are available in theme_plot

Controlling level of detail

Although the HTML canvas can comfortably display tens or even hundreds of thousands of glyphs, doing so can have adverse affects on interactive performance. In order to accommodate large-ish (but not enormous) data sizes, Bokeh plots offer "Level of Detail" (LOD) capability in the client.

The basic idea is that during interactive operations (e.g., panning or zooming), the plot only draws some small fraction data points. This hopefully allows the general sense of the interaction to be preserved mid-flight, while maintaining interactive performance. See the lod_ parameters for information on how to control this.

See also


figure() %>% ly_points(1:10)