Learn R Programming

rbokeh (version 0.5.2)

figure: Initialize a Bokeh figure

Description

Initialize a Bokeh figure

Usage

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,
  ...
)

Arguments

data

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

width

figure width in pixels

height

figure width in pixels

title

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.

xlab

label for x axis

ylab

label for y axis

xlim

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

ylim

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

padding_factor

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

xgrid

whether to draw x axis grid lines

ygrid

whether to draw y axis grid lines

xaxes

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

yaxes

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

legend_location

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

tools

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.

theme

an rbokeh theme to use

toolbar_location

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

h_symmetry

(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).

v_symmetry

(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).

logo

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

lod_factor

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

lod_interval

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

lod_threshold

(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").

lod_timeout

(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").

webgl

(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

Layers to add to a figure: ly_abline; ly_annular_wedge; ly_annulus; ly_arc; ly_bezier; ly_boxplot; ly_contour; ly_crect; ly_curve; ly_density; ly_hist; ly_image_url; ly_image; ly_lines; ly_map; ly_multi_line; ly_oval; ly_patch; ly_points; ly_polygons; ly_quadratic; ly_quantile; ly_ray; ly_segments; ly_text; ly_wedge Tools to add to a figure: tool_box_select; tool_box_zoom; tool_crosshair; tool_lasso_select; tool_reset; tool_resize; tool_save; tool_wheel_zoom Other figure types: grid_plot; gmap

Examples

Run this code
# NOT RUN {
figure() %>% ly_points(1:10)
# }

Run the code above in your browser using DataLab