| Title: | 'Jupyter' Display Machinery |
|---|---|
| Description: | An interface to the rich display capabilities of 'Jupyter' front-ends (e.g. 'Jupyter Notebook') <https://jupyter.org>. Designed to be used from a running 'IRkernel' session <https://irkernel.github.io>. |
| Authors: | Thomas Kluyver [aut, cph], Philipp Angerer [aut, cph, cre] (ORCID: <https://orcid.org/0000-0002-0369-2888>), Jan Schulz [aut, cph] |
| Maintainer: | Philipp Angerer <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.1.0.9000 |
| Built: | 2026-05-08 05:17:35 UTC |
| Source: | https://github.com/irkernel/irdisplay |
Both functions create a mimebundle for multiple reprs.
display proceeds to publish it using publish_mimebundle.
prepare_mimebundle returns it (see Value for details)
display( obj, ..., mimetypes = getOption("jupyter.display_mimetypes"), error_handler = stop ) prepare_mimebundle( obj, mimetypes = getOption("jupyter.display_mimetypes"), metadata = NULL, error_handler = stop )display( obj, ..., mimetypes = getOption("jupyter.display_mimetypes"), error_handler = stop ) prepare_mimebundle( obj, mimetypes = getOption("jupyter.display_mimetypes"), metadata = NULL, error_handler = stop )
obj |
The object to create representations for |
mimetypes |
Mimetypes to create reprs for. The defaults are defined by the option |
error_handler |
Function used when errors in individual reprs occur |
metadata, ...
|
Metadata to attach to the result (can be expanded by additional metadata) |
prepare_mimebundle returns a list with items corresponding to the parameters of publish_mimebundle (data and metadata)
bundle <- prepare_mimebundle(diag(3)) ## Not run: ## (Run inside of an IRkernel) display(help(display)) ## End(Not run)bundle <- prepare_mimebundle(diag(3)) ## Not run: ## (Run inside of an IRkernel) display(help(display)) ## End(Not run)
Either data or file must be passed.
display_png(data = NULL, file = NULL, width = NULL, height = NULL) display_jpeg(data = NULL, file = NULL, width = NULL, height = NULL) display_pdf(data = NULL, file = NULL, width = NULL, height = NULL) display_svg(data = NULL, file = NULL, width = NULL, height = NULL)display_png(data = NULL, file = NULL, width = NULL, height = NULL) display_jpeg(data = NULL, file = NULL, width = NULL, height = NULL) display_pdf(data = NULL, file = NULL, width = NULL, height = NULL) display_svg(data = NULL, file = NULL, width = NULL, height = NULL)
data |
|
file |
The path to a file or a |
width |
The width to display the image |
height |
The height to display the image |
## Not run: ## (Run inside of an IRkernel) display_png(file = 'image.png') display_svg(' <svg xmlns="http://www.w3.org/2000/svg" viewBox="-1 -1 2 2"> <circle r="1"/> </svg> ') display_jpeg(file = url('https://dummyimage.com/600x400.jpg', 'wb'), width = 100) ## End(Not run)## Not run: ## (Run inside of an IRkernel) display_png(file = 'image.png') display_svg(' <svg xmlns="http://www.w3.org/2000/svg" viewBox="-1 -1 2 2"> <circle r="1"/> </svg> ') display_jpeg(file = url('https://dummyimage.com/600x400.jpg', 'wb'), width = 100) ## End(Not run)
Either data or file must be passed.
display_text(data = NULL, file = NULL) display_json(data = NULL, file = NULL) display_javascript(data = NULL, file = NULL) display_html(data = NULL, file = NULL) display_markdown(data = NULL, file = NULL) display_latex(data = NULL, file = NULL)display_text(data = NULL, file = NULL) display_json(data = NULL, file = NULL) display_javascript(data = NULL, file = NULL) display_html(data = NULL, file = NULL) display_markdown(data = NULL, file = NULL) display_latex(data = NULL, file = NULL)
data |
The code or markup content as a |
file |
The path to a file or a |
## Not run: ## (Run inside of an IRkernel) display_text('Just text') display_markdown('[MD](http://commonmark.org) *formatted*') display_javascript('execute(this)') ## End(Not run)## Not run: ## (Run inside of an IRkernel) display_text('Just text') display_markdown('[MD](http://commonmark.org) *formatted*') display_javascript('execute(this)') ## End(Not run)
Some options to control the formats display and prepare_mimebundle emit,
and the function they use to display them.
irdisplay_option_defaultsirdisplay_option_defaults
An object of class list of length 3.
jupyter.display_mimetypesThe default is all MIME types supported by Jupyter.
jupyter.base_display_funcFunction used by display and all display_<text> / display_<image> functions.
Has the signature function(data, metadata = NULL).
Per default emits a warning, and is set when running an IRkernel.
jupyter.clear_output_funcFunction used by clear_output. Has the signature function(wait = TRUE).
Per default emits a warning, and is set when running an IRkernel.
publish_mimebundle calls the function stored as option value of jupyter.base_display_func,
clear_output calls the value of option jupyter.clear_output_func. (see: IRdisplay-options)
publish_mimebundle(data, metadata = NULL) clear_output(wait = TRUE)publish_mimebundle(data, metadata = NULL) clear_output(wait = TRUE)
data |
A named list mapping mimetypes to content ( |
metadata |
A named list mapping mimetypes to named lists of metadata, e.g. |
wait |
Wait to clear the output until new output is available. Default |
clear_output: Clear the output from the current cell.
## Not run: ## (Run inside of an IRkernel) publish_mimebundle(list('text/html' = '<h1>Hi!</h1>')) publish_mimebundle( list('image/svg+xml' = '<svg xmlns="http://www.w3.org/2000/svg"><circle r="100"/></svg>'), list('image/svg+xml' = list(width = 100, height = 100))) for (i in 1:5) { Sys.sleep(.2) # simulate work clear_output() # clear previous iteration cat(i) # alternative: IRdisplay::display(i) flush.console() # make output available } ## End(Not run)## Not run: ## (Run inside of an IRkernel) publish_mimebundle(list('text/html' = '<h1>Hi!</h1>')) publish_mimebundle( list('image/svg+xml' = '<svg xmlns="http://www.w3.org/2000/svg"><circle r="100"/></svg>'), list('image/svg+xml' = list(width = 100, height = 100))) for (i in 1:5) { Sys.sleep(.2) # simulate work clear_output() # clear previous iteration cat(i) # alternative: IRdisplay::display(i) flush.console() # make output available } ## End(Not run)