In [1]:
library(IRdisplay)
In [2]:
display_html('<h1 style="background-color:#fe57a1">HTML output</h1>')
Plotting in R is displayed automatically, but if you want to display a PNG from another source, this is how to do it:
In [3]:
tf <- tempfile()
png(tf)
plot(1:10, 1:10)
dev.off()
display_png(file = tf)
Out[3]:
The following will result in the preferred image format being chosen by the frontend:
In [4]:
publish_mimebundle(list(
'image/svg+xml' = '<svg width="10" height="10"><circle r="5" cx="5" cy="5"/></svg>',
'text/plain' = 'A circle'))
There are a few convenience function to display individual representations with common metadata:
In [5]:
display_png(file = tf, width = 50, height = 50)