Public API for display tools in IPython.
Bases: IPython.core.display.DisplayObject
Create an audio object.
When this object is returned by an input cell or passed to the display function, it will result in Audio controls being displayed in the frontend (only works in the notebook).
Parameters: | data : numpy array, list, unicode, str or bytes
url : unicode
filename : unicode
embed : boolean
rate : integer
autoplay : bool
|
---|
Examples
# Generate a sound
import numpy as np
framerate = 44100
t = np.linspace(0,5,framerate*5)
data = np.sin(2*np.pi*220*t) + np.sin(2*np.pi*224*t))
Audio(data,rate=framerate)
# Can also do stereo or more channels
dataleft = np.sin(2*np.pi*220*t)
dataright = np.sin(2*np.pi*224*t)
Audio([dataleft, dataright],rate=framerate)
Audio("http://www.nch.com.au/acm/8k16bitpcm.wav") # From URL
Audio(url="http://www.w3schools.com/html/horse.ogg")
Audio('/path/to/sound.wav') # From file
Audio(filename='/path/to/sound.ogg')
Audio(b'RAW_WAV_DATA..) # From bytes
Audio(data=b'RAW_WAV_DATA..)
Reload the raw data from file or URL.
Bases: object
An object that wraps data to be displayed.
Create a display object given raw data.
When this object is returned by an expression or passed to the display function, it will result in the data being displayed in the frontend. The MIME type of the data should match the subclasses used, so the Png subclass should be used for ‘image/png’ data. If the data is a URL, the data will first be downloaded and then displayed. If
Parameters: | data : unicode, str or bytes
url : unicode
filename : unicode
|
---|
Reload the raw data from file or URL.
Bases: object
Class for embedding a local file link in an IPython session, based on path
e.g. to embed a link that was generated in the IPython notebook as my/data.txt
you would do:
local_file = FileLink("my/data.txt")
display(local_file)
or in the HTML notebook, just:
FileLink("my/data.txt")
Parameters: | path : str
directory_prefix : str
result_html_prefix : str
result_html_suffix : str
|
---|
Bases: IPython.lib.display.FileLink
Class for embedding local file links in an IPython session, based on path
e.g. to embed links to files that were generated in the IPython notebook under my/data, you would do:
local_files = FileLinks("my/data")
display(local_files)
or in the HTML notebook, just:
FileLinks("my/data")
See FileLink for the path, url_prefix, result_html_prefix and result_html_suffix parameters.
Formatter functions must be of the form:
f(dirname, fnames, included_suffixes)
The function should return a list of lines that will be printed in the notebook (if passing notebook_display_formatter) or the terminal (if passing terminal_display_formatter). This function is iterated over for each directory in self.path. Default formatters are in place, can be passed here to support alternative formatting.
Bases: IPython.core.display.TextDisplayObject
Bases: object
Generic class to embed an iframe in an IPython notebook
Bases: IPython.core.display.DisplayObject
Create a PNG/JPEG image object given raw data.
When this object is returned by an input cell or passed to the display function, it will result in the image being displayed in the frontend.
Parameters: | data : unicode, str or bytes
url : unicode
filename : unicode
format : unicode
embed : bool
width : int
height : int
retina : bool
unconfined: bool
metadata: dict
|
---|
Examples
# embedded image data, works in qtconsole and notebook # when passed positionally, the first arg can be any of raw image data, # a URL, or a filename from which to load image data. # The result is always embedding image data for inline images. Image(‘http://www.google.fr/images/srpr/logo3w.png‘) Image(‘/path/to/image.jpg’) Image(b’RAW_PNG_DATA...’)
# Specifying Image(url=...) does not embed the image data, # it only generates <img> tag with a link to the source. # This will not work in the qtconsole or offline. Image(url=’http://www.google.fr/images/srpr/logo3w.png‘)
Reload the raw data from file or URL.
Bases: IPython.core.display.DisplayObject
JSON expects a JSON-able dict or list
not an already-serialized JSON string.
Scalar types (None, number, string) are not allowed, only dict or list containers.
Bases: IPython.core.display.TextDisplayObject
Create a Javascript display object given raw data.
When this object is returned by an expression or passed to the display function, it will result in the data being displayed in the frontend. If the data is a URL, the data will first be downloaded and then displayed.
In the Notebook, the containing element will be available as element, and jQuery will be available. Content appended to element will be visible in the output area.
Parameters: | data : unicode, str or bytes
url : unicode
filename : unicode
lib : list or str
css: : list or str
|
---|
Bases: IPython.core.display.TextDisplayObject
Bases: IPython.core.display.TextDisplayObject
Bases: IPython.core.display.TextDisplayObject
Bases: IPython.core.display.TextDisplayObject
Bases: IPython.core.display.DisplayObject
Bases: IPython.lib.display.IFrame
Class for embedding a Scribd document in an IPython session
Use the start_page params to specify a starting point in the document Use the view_mode params to specify display type one off scroll | slideshow | book
e.g to Display Wes’ foundational paper about PANDAS in book mode from page 3
ScribdDocument(71048089, width=800, height=400, start_page=3, view_mode=”book”)
Bases: IPython.core.display.DisplayObject
Validate that display data is text
Bases: IPython.lib.display.IFrame
Class for embedding a Vimeo video in an IPython session, based on its video id.
Bases: IPython.lib.display.IFrame
Class for embedding a YouTube Video in an IPython session, based on its video id.
e.g. to embed the video from https://www.youtube.com/watch?v=foo , you would do:
vid = YouTubeVideo("foo")
display(vid)
To start from 30 seconds:
vid = YouTubeVideo("abc", start=30)
display(vid)
To calculate seconds from time as hours, minutes, seconds use datetime.timedelta:
start=int(timedelta(hours=1, minutes=46, seconds=40).total_seconds())
Other parameters can be provided as documented at https://developers.google.com/youtube/player_parameters#parameter-subheader
Clear the output of the current cell receiving output.
Parameters: | wait : bool [default: false]
|
---|
Display a Python object in all frontends.
By default all representations will be computed and sent to the frontends. Frontends can decide which representation is used and how.
Parameters: | objs : tuple of objects
raw : bool, optional
include : list or tuple, optional
exclude : list or tuple, optional
metadata : dict, optional
|
---|
Display the HTML representation of an object.
Parameters: | objs : tuple of objects
raw : bool
metadata : dict (optional)
|
---|
Display the Javascript representation of an object.
Parameters: | objs : tuple of objects
raw : bool
metadata : dict (optional)
|
---|
Display the JPEG representation of an object.
Parameters: | objs : tuple of objects
raw : bool
metadata : dict (optional)
|
---|
Display the JSON representation of an object.
Note that not many frontends support displaying JSON.
Parameters: | objs : tuple of objects
raw : bool
metadata : dict (optional)
|
---|
Display the LaTeX representation of an object.
Parameters: | objs : tuple of objects
raw : bool
metadata : dict (optional)
|
---|
Displays the Markdown representation of an object.
Parameters: | objs : tuple of objects
raw : bool
metadata : dict (optional)
|
---|
Display the PDF representation of an object.
Parameters: | objs : tuple of objects
raw : bool
metadata : dict (optional)
|
---|
Display the PNG representation of an object.
Parameters: | objs : tuple of objects
raw : bool
metadata : dict (optional)
|
---|
Display the pretty (default) representation of an object.
Parameters: | objs : tuple of objects
raw : bool
metadata : dict (optional)
|
---|
Display the SVG representation of an object.
Parameters: | objs : tuple of objects
raw : bool
metadata : dict (optional)
|
---|
Publish data and metadata to all frontends.
See the display_data message in the messaging documentation for more details about this message type.
The following MIME types are currently implemented:
Parameters: | data : dict
metadata : dict
source : str, deprecated
|
---|
Set whether the inline backend closes all figures automatically or not.
By default, the inline backend used in the IPython Notebook will close all matplotlib figures automatically after each cell is run. This means that plots in different cells won’t interfere. Sometimes, you may want to make a plot in one cell and then refine it in later cells. This can be accomplished by:
In [1]: set_matplotlib_close(False)
To set this in your config files use the following:
c.InlineBackend.close_figures = False
Parameters: | close : bool
|
---|
Select figure formats for the inline backend. Optionally pass quality for JPEG.
For example, this enables PNG and JPEG output with a JPEG quality of 90%:
In [1]: set_matplotlib_formats('png', 'jpeg', quality=90)
To set this in your config files use the following:
c.InlineBackend.figure_formats = {'png', 'jpeg'}
c.InlineBackend.print_figure_kwargs.update({'quality' : 90})
Parameters: | *formats : strs
**kwargs :
|
---|