ann_box {rbokeh} | R Documentation

## Add a "box" annotation (rectangular shaded region) to a Bokeh figure

### Description

Add a "box" annotation (rectangular shaded region) to a Bokeh figure

### Usage

    ann_box(fig, left = NULL, bottom = NULL, right = NULL, top = NULL,
      left_units = NULL, bottom_units = NULL, right_units = NULL,
      top_units = NULL, color = NULL, alpha = NULL, lgroup = NULL,
      lname = NULL, ...)

### Arguments

`fig` | Figure to modify.
`left` | The x-coordinates of the left edge of the box annotation. Datetime values are also accepted, but note that they are immediately converted to milliseconds-since-epoch.
`bottom` | The y-coordinates of the bottom edge of the box annotation. Datetime values are also accepted, but note that they are immediately converted to milliseconds-since-epoch.
`right` | The x-coordinates of the right edge of the box annotation. Datetime values are also accepted, but note that they are immediately converted to milliseconds-since-epoch.
`top` | The y-coordinates of the top edge of the box annotation. Datetime values are also accepted, but note that they are immediately converted to milliseconds-since-epoch.
`left_units` | The unit type for the left attribute. Interpreted as "data space" units by default. One of "data" or "screen".
`bottom_units` | The unit type for the bottom attribute. Interpreted as "data space" units by default. One of "data" or "screen".
`right_units` | The unit type for the right attribute. Interpreted as "data space" units by default. One of "data" or "screen".
`top_units` | The unit type for the top attribute. Interpreted as "data space" units by default. One of "data" or "screen".
`color` | Color for the glyph - a hex code (with no alpha) or any of the 147 named CSS colors, e.g 'green', 'indigo'. For glyphs with both fill and line properties, see "Handling color" below.
`alpha` | The alpha transparency of the glyph between 0 (transparent) and 1 (opaque). If the glyph has both fill and color properties, see "Handling alpha" below.
`lgroup` | Layer group.
`lname` | Layer name.
`...` | additional parameters for fine control over fill and line properties (see "Additional parameters" below)

### Handling color

The `color` parameter is a high-level plot attribute that provides default behavior for coloring glyphs.

- When using a glyph that only has line properties, this will be the color of the line.

- When using a glyph that has has line and fill properties, this will be the color of the line and the fill, with the alpha level of the fill reduced by 50%.

- If full control over fill and line color is desired, the `fill_color` and `line_color` attributes can be specified explicitly and will override `color`.

When color is `NULL` and `fill_color` or `line_color` are not specified, the color will be chosen from the theme.

### Handling alpha

The `alpha` is a high-level plot attribute that sets the transparency of the glyph being plotted.

- When using a glyph that only has line properties, this will be the alpha of the line.

- When using a glyph that has has line and fill properties, this will be the alpha of the line and the alpha of the fill will be set to 50% of this value.

- Individual fill and line alpha can be specified with `fill_alpha` and `line_alpha` and will override `alpha`.

### Additional parameters

`fill_color` | color to use to fill the glyph with - a hex code (with no alpha) or any of the 147 named CSS colors, e.g 'green', 'indigo'
`fill_alpha` | transparency value between 0 (transparent) and 1 (opaque)
`line_color` | color to use to stroke lines with - a hex code (with no alpha) or any of the 147 named CSS colors, e.g 'green', 'indigo'
`line_width` | stroke width in units of pixels
`line_alpha` | transparency value between 0 (transparent) and 1 (opaque)
`line_join` | how path segments should be joined together 'miter' 'round' 'bevel'
`line_cap` | how path segments should be terminated 'butt' 'round' 'square'
`line_dash` | array of integer pixel distances that describe the on-off pattern of dashing to use
`line_dash_offset` | the distance in pixels into the line_dash that the pattern should start from

### See Also

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

### Examples

    figure(data = iris) %>%
      ly_points(x = Sepal.Width, y = Sepal.Length, color = Species) %>%
      ann_box(bottom = 5, color = "black")

    # with screen units
    figure(data = iris) %>%
      ly_points(x = Sepal.Width, y = Sepal.Length, color = Species) %>%
      ann_box(bottom = 540, bottom_units = "screen", color = "black")

    # text annotation with box annotation and screen units to illustrate
    # an inside-plot heading that doesn't move with pan/zoom
    figure(data = iris) %>%
      ly_points(x = Sepal.Width, y = Sepal.Length, color = Species) %>%
      ann_box(bottom = 565, bottom_units = "screen", color = "black") %>%
      ann_labels(200, 570, "Header", text_color = "white",
        x_units = "screen", y_units = "screen")

[Package rbokeh version 0.6.3 Index]