Learn R Programming

rbokeh (version 0.4.2)

ly_image_url: Add an "image_url" layer to a Bokeh figure

Description

Renders raster images from URLs at provided coordinates

Usage

ly_image_url(fig, x = 0, y = 0, data = figure_data(fig), w = 10, h = 10, image_url, dilate = TRUE, anchor = "top_left", angle = 0, lname = NULL, lgroup = NULL, visible = TRUE)

Arguments

fig
figure to modify
x
x coordinates
y
y coordinates
data
an optional data frame, providing the source for inputs x, y, and other properties
w, h
values or field names of width and height of image
image_url
values or field name of image URLs
dilate
logical - whether to dilate pixel distance computations when drawing
anchor
where the image is anchored to with respect to x and y
angle
values or field name of the angle to rotate the image, in radians
lname
layer name
lgroup
layer group
visible
should the layer be visible?

See Also

Other layer functions: ly_abline, ly_annular_wedge, ly_annulus, ly_arc, ly_bar, ly_bezier, ly_boxplot, ly_contour, ly_crect, ly_curve, ly_density, ly_hist, ly_image, ly_lines, ly_map, ly_multi_line, ly_oval, ly_patch, ly_points, ly_polygons, ly_quadratic, ly_quantile, ly_ray, ly_rect, ly_segments, ly_text, ly_wedge

Examples

Run this code

url <- c("http://bokeh.pydata.org/en/latest/_static/bokeh-transparent.png",
  "http://developer.r-project.org/Logo/Rlogo-4.png")

ss <- seq(0, 2*pi, length = 13)[-1]
ws <- runif(12, 2.5, 5) * rep(c(1, 0.8), 6)

imgdat <- data.frame(
  x = sin(ss) * 10, y = cos(ss) * 10,
  w = ws, h = ws * rep(c(1, 0.76), 6),
  url = rep(url, 6)
)

p <- figure(xlab = "x", ylab = "y") %>%
  ly_image_url(x, y, w = w, h = h, image_url = url, data = imgdat,
    anchor = "center") %>%
  ly_lines(sin(c(ss, ss[1])) * 10, cos(c(ss, ss[1])) * 10,
    width = 15, alpha = 0.1)
p

Run the code above in your browser using DataLab