ann_labels {rbokeh} | R Documentation

## Add a "label" annotation to a Bokeh figure

### Description

Add a "label" annotation to a Bokeh figure

### Usage

    ann_labels(fig, x = NULL, y = NULL, text = NULL, angle = NULL,
      data = figure_data(fig), x_units = NULL, y_units = NULL,
      angle_units = NULL, x_offset = NULL, y_offset = NULL,
      text_align = NULL, text_color = NULL, text_alpha = NULL,
      text_font = NULL, text_font_size = NULL, text_font_style = NULL,
      text_baseline = NULL, background_fill_color = NULL,
      background_fill_alpha = NULL, border_line_color = NULL,
      border_line_alpha = NULL, border_line_width = NULL,
      border_line_join = NULL, border_line_dash = NULL,
      border_line_dash_offset = NULL, border_line_cap = NULL,
      render_mode = NULL, lgroup = NULL, lname = NULL)

### Arguments

`fig` | Figure to modify.
`x` | The x-coordinates to locate the text anchors.
`y` | The y-coordinates to locate the text anchors.
`text` | The text values to render.
`angle` | The angles to rotate the text, as measured from the horizontal. Warning: The center of rotation for canvas and css render_modes is different. For `render_mode="canvas"` the label is rotated from the top-left corner of the annotation, while for `render_mode="css"` the annotation is rotated around it's center.
`data` | An optional data frame supplying data to which other parameters can refer.
`x_units` | The unit type for the xs attribute. Interpreted as "data space" units by default. One of "data" or "screen".
`y_units` | The unit type for the ys attribute. Interpreted as "data space" units by default. One of "data" or "screen".
`angle_units` | One of "rad" or "deg".
`x_offset` | Offset values to apply to the x-coordinates. This is useful, for instance, if it is desired to "float" text a fixed distance in screen units from a given data position.
`y_offset` | Offset values to apply to the y-coordinates. This is useful, for instance, if it is desired to "float" text a fixed distance in screen units from a given data position.
`text_align` | The text align values for the text.
`text_color` | The text color values for the text.
`text_alpha` | The text alpha values for the text.
`text_font` | The text font values for the text.
`text_font_size` | The text font size values for the text.
`text_font_style` | The text font style values for the text.
`text_baseline` | The text baseline values for the text.
`background_fill_color` | The fill color values for the text bounding box.
`background_fill_alpha` | The fill alpha values for the text bounding box.
`border_line_color` | The line color values for the text bounding box.
`border_line_alpha` | The line alpha values for the text bounding box.
`border_line_width` | The line width values for the text bounding box.
`border_line_join` | The line join values for the text bounding box.
`border_line_dash` | The line dash values for the text bounding box.
`border_line_dash_offset` | The line dash offset values for the text bounding box.
`border_line_cap` | The line cap values for the text bounding box.

`render_mode`

Specifies whether the text is rendered as a canvas element or as an css element overlaid on the canvas. The default mode is "canvas". Note: The CSS labels won't be present in the output using the "save" tool. Warning: Not all visual styling properties are supported if the render_mode is set to "css". The border_line_dash property isn't fully supported and border_line_dash_offset isn't supported at all. Setting text_alpha will modify the opacity of the entire background box and border in addition to the text. Finally, clipping label annotations inside of the plot area isn't supported in "css" mode.

`lgroup` | Layer group.
`lname` | Layer name.

### See Also

Other annotation functions: `ann_arrow`, `ann_band`, `ann_box`, `ann_poly`, `ann_span`, `ann_title`, `ann_whisker`, `arrow`

### Examples

    d <- data.frame(x = 1:10, y = rnorm(10), txt = letters[1:10])
    figure(data = d) %>%
      ly_points(x, y) %>%
      ann_labels(x, y, txt)

[Package rbokeh version 0.6.3 Index]