How to display a table of images in R output in a Jupyter notebook? -
how take list of image urls, , display them in html table in jupyter notebook r kernel?
here's list of urls:
image_urls = c('https://i.stack.imgur.com/wdqnm.jpg', 'https://i.stack.imgur.com/8oysp.jpg')
here's code display 1 image image_url
:
library(jpeg) library(rcurl) img <- rcurl::getbinaryurl(image_url) jj <- jpeg::readjpeg(img,native=true) plot(0:1,0:1,type="n",ann=false,axes=false) rasterimage(jj,0,0,1,1)
edit: way think of is, there functionality ipython's display
? looks there might in https://github.com/irkernel/repr. have read more.
i’m maintainer of irkernel-related projects.
irdisplay
package you’re searching for, display_jpeg
:
library(irdisplay) display_jpeg(file = 'filename.jpg')
sadly file
parameter doesn’t work urls (yet), have manually pass data it:
jpeg_data <- rcurl::getbinaryurl(image_url) display_jpeg(jpeg_data)
Comments
Post a Comment