from IPython.display import *
%%capture
from urllib.request import urlretrieve
helpers="http://www.evanmarie.com/content/files/helpers/helpers.py"
urlretrieve(helpers, "helpers.py")
import helpers as h
from helpers import p, sp, d, pretty
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.Audio
(data=None, filename=None, url=None, embed=None, rate=None, autoplay=False, normalize=True, *, element_id=None)
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) –
- Can be one of
- Numpy 1d array containing the desired waveform (mono)
- Numpy 2d array containing waveforms for each channel. Shape=(NCHAN, NSAMPLES). For the standard channel order, see http://msdn.microsoft.com/en-us/library/windows/hardware/dn653308(v=vs.85).aspx
- List of float or integer representing the waveform (mono)
- String containing the filename
- Bytestring containing raw PCM data or
- URL pointing to a file on the web.
- If the array option is used, the waveform will be normalized.
- If a filename or url is used, the format support will be browser dependent.
- url (unicode) – A URL to download the data from.
- filename (unicode) – Path to a local file to load the data from.
- embed (boolean) – Should the audio data be embedded using a data URI (True) or should the original source be referenced. Set this to True if you want the audio to playable later with no internet connection in the notebook.
- Default is True, unless the keyword argument url is set, then default value is False.
- rate (integer) – The sampling rate of the raw data. Only required when data parameter is being used as an array
- autoplay (bool) – Set to True if the audio should immediately start playing. Default is False.
- normalize (bool) – Whether audio should be normalized (rescaled) to the maximum possible range. Default is True. When set to False, data must be between -1 and 1 (inclusive), otherwise an error is raised. Applies only when data is a list or array of samples; other types of audio are never normalized.
%%capture
!pip install pytest
import pytest
np = pytest.importorskip("numpy")
import numpy as np
Generate a sound:
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)
Mulitple Channels:
# Multiple Channels
dataleft = np.sin(2*np.pi*220*t)
dataright = np.sin(2*np.pi*224*t)
Audio([dataleft, dataright], rate=framerate)
From a URL:
d(Audio("http://www.nch.com.au/acm/8k16bitpcm.wav"))
d(Audio("http://www.nch.com.au/acm/8k16bitpcm.wav"))
d(Audio(url="http://www.w3schools.com/html/horse.ogg"))
d(Audio(url="http://www.w3schools.com/html/horse.ogg"))
From a file:
# Audio('IPython/lib/tests/test.wav')
# Audio(filename='IPython/lib/tests/test.wav')
From bytes:
Audio(b'RAW_WAV_DATA..')
Audio(data=b'RAW_WAV_DATA..')
__init__(data=None, filename=None, url=None, embed=None, rate=None, autoplay=False, normalize=True, *, element_id=None)¶
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) – The raw data or a URL or file to load the data from
- url (unicode) – A URL to download the data from.
- filename (unicode) – Path to a local file to load the data from.
- metadata (dict) – Dict of metadata associated to be the object when displayed
- reload()¶ Reload the raw data from file or URL.
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.Code
(data=None, url=None, filename=None, language=None)
Display syntax-highlighted source code.
This uses Pygments to highlight the code for HTML and Latex output.
Parameters
- data (str) – The code as a string
- url (str) – A URL to fetch the code from
- filename (str) – A local filename to load the code from
- language (str) – The short name of a Pygments lexer to use for highlighting. If not specified, it will guess the lexer based on the filename or the code. Available lexers: http://pygments.org/docs/lexers/
__init__(data=None, url=None, filename=None, language=None)¶
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) – The raw data or a URL or file to load the data from
- url (unicode) – A URL to download the data from.
- filename (unicode) – Path to a local file to load the data from.
- metadata (dict) – Dict of metadata associated to be the object when displayed
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.DisplayObject
(data=None, url=None, filename=None, metadata=None)
An object that wraps data to be displayed.
__init__(data=None, url=None, filename=None, metadata=None)¶
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) – The raw data or a URL or file to load the data from
- url (unicode) – A URL to download the data from.
- filename (unicode) – Path to a local file to load the data from.
- metadata (dict) – Dict of metadata associated to be the object when displayed
- reload()¶ Reload the raw data from file or URL.
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.FileLink
(path, url_prefix='', result_html_prefix='', result_html_suffix='<br>')
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
__init__(path, url_prefix='', result_html_prefix='', result_html_suffix='<br>')¶
Parameters
path (str) – path to the file or directory that should be formatted
- url_prefix (str) – prefix to be prepended to all files to form a working link [default: ‘’]
- result_html_prefix (str) – text to append to beginning to link [default: ‘’]
- result_html_suffix (str) – text to append at the end of link [default: ‘<br>’]
Display local data:
local_file = FileLink("tmp.txt")
d(local_file)
FileLink("tmp.txt")
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.FileLinks
(path, url_prefix='', included_suffixes=None, result_html_prefix='', result_html_suffix='<br>', notebook_display_formatter=None, terminal_display_formatter=None, recursive=True)
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,
Label:
local_files = FileLinks("../Pandas Intensive/Ipython")
display(local_files)
FileLinks("../Pandas Intensive/Ipython")
__init__(path, url_prefix='', included_suffixes=None, result_html_prefix='', result_html_suffix='<br>', notebook_display_formatter=None, terminal_display_formatter=None, recursive=True)¶
See FileLink for the path, url_prefix, result_html_prefix and result_html_suffix parameters.
included_suffixeslist
Filename suffixes to include when formatting output [default: include all files]
notebook_display_formatterfunction
Used to format links for display in the notebook. See discussion of formatter functions below.
terminal_display_formatterfunction
Used to format links for display in the terminal. See discussion of formatter functions below.
Formatter functions must be of the form:
f(dirname, fnames, included_suffixes)
dirnamestr
The name of a directory
fnameslist
The files in that directory
included_suffixeslist
The file suffixes that should be included in the output (passing None meansto include all suffixes in the output in the built-in formatters)
recursiveboolean
Whether to recurse into subdirectories. Default is True.
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.
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.GeoJSON
(*args, **kwargs)
GeoJSON expects JSON-able dict
not an already-serialized JSON string.
Scalar types (None, number, string) are not allowed, only dict containers.
__init__(*args, **kwargs)¶
Create a GeoJSON display object given raw data.
Parameters
data (dict or list) – VegaLite data. Not an already-serialized JSON string. Scalar types (None, number, string) are not allowed, only dict or list containers.
url_template (string) – Leaflet TileLayer URL template: http://leafletjs.com/reference.html#url-template
layer_options (dict) – Leaflet TileLayer options: http://leafletjs.com/reference.html#tilelayer-options
url (unicode) – A URL to download the data from.
filename (unicode) – Path to a local file to load the data from.
metadata (dict) – Specify extra metadata to attach to the json display object.
Examples
The following will display an interactive map of Mars with a point of interest on frontend that do support GeoJSON display.
Creating the GeoJSON Object:
example = GeoJSON(data={
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-81.327, 296.038]
}
},
url_template="http://s3-eu-west-1.amazonaws.com/whereonmars.cartodb.net/{basemap_id}/{z}/{x}/{y}.png",
layer_options={
"basemap_id": "celestia_mars-shaded-16k_global",
"attribution" : "Celestia/praesepe",
"minZoom" : 0,
"maxZoom" : 18,
})
example
<IPython.display.GeoJSON object>
Importing from URL:
%%capture
!pip install geopandas
import geopandas as gpd
df = gpd.read_file("https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_rivers_lake_centerlines_scale_rank.geojson")
df.sample(3)
strokeweig | scalerank | featurecla | name | dissolve | note | featureclass | geometry | |
---|---|---|---|---|---|---|---|---|
1149 | 0.20 | 6 | None | Albany | Lake CenterlineAlbany | None | Lake Centerline | LINESTRING (-91.31225 51.06272, -91.07498 50.9... |
193 | 0.25 | 5 | None | Indigirka | RiverIndigirka | None | River | LINESTRING (144.88452 67.84653, 144.59389 67.8... |
1481 | 0.25 | 6 | None | Chenab | RiverChenab | None | River | LINESTRING (73.13913 31.90208, 72.97434 31.758... |
Read from file:
df = gpd.read_file("./Ipython/sample.geojson")
df.sample(3)
strokeweig | scalerank | featurecla | name | dissolve | note | featureclass | geometry | |
---|---|---|---|---|---|---|---|---|
280 | 0.30 | 4 | None | Aldan | RiverAldan | None | River | LINESTRING (132.36601 59.24189, 132.63824 59.3... |
1157 | 0.30 | 6 | None | Albany | RiverAlbany | None | River | LINESTRING (-82.05468 52.13837, -81.88275 52.1... |
1610 | 0.30 | 6 | None | Potomac | RiverPotomac | None | River | LINESTRING (-77.48092 39.11296, -77.30109 39.0... |
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.HTML
(data=None, url=None, filename=None, metadata=None)
__init__(data=None, url=None, filename=None, metadata=None)¶
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) – The raw data or a URL or file to load the data from
- url (unicode) – A URL to download the data from.
- filename (unicode) – Path to a local file to load the data from.
- metadata (dict) – Dict of metadata associated to be the object when displayed
Displaying straight text:
display(HTML("<font size= 5><b><i>Hi, how are ya?</i></b></font>"))
Label:
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.IFrame
(src, width, height, extras: Optional[Iterable[str]] = None, **kwargs)
Generic class to embed an iframe in an IPython notebook
__init__(src, width, height, extras: Optional[Iterable[str]] = None, **kwargs)¶
IFrame from .txt file:
IFrame("./Ipython/sample.txt", width=300, height=30)
IFrame from .jpeg file:
IFrame("./Ipython/dog.jpeg", width=200, height=200)
IFrame from .pdf file:
IFrame("./Ipython/dog.pdf", width=500, height=300)
IFrame('http://jupyter.org/', '100%', 400)
IFrame('http://www.EvanMarie.com/', '100%', 400)
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.Image
(data=None, url=None, filename=None, format=None, embed=None, width=None, height=None, retina=False, unconfined=False, metadata=None, alt=None)
__init__(data=None, url=None, filename=None, format=None, embed=None, width=None, height=None, retina=False, unconfined=False, metadata=None, alt=None)¶
Create a PNG/JPEG/GIF 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) – The raw image data or a URL or filename to load the data from. This always results in embedded image data.
- url (unicode) – A URL to download the data from. If you specify url=, the image data will not be embedded unless you also specify embed=True.
- filename (unicode) – Path to a local file to load the data from. Images from a file are always embedded.
- format (unicode) – The format of the image data (png/jpeg/jpg/gif). If a filename or URL is given for format will be inferred from the filename extension.
embed (bool) – Should the image data be embedded using a data URI (True) or be loaded using an <img> tag. Set this to True if you want the image to be viewable later with no internet connection in the notebook.
- Default is True, unless the keyword argument url is set, then default value is False.
- Note that QtConsole is not able to display images if embed is set to False
- width (int) – Width in pixels to which to constrain the image in html
- height (int) – Height in pixels to which to constrain the image in html
- retina (bool) – Automatically set the width and height to half of the measured width and height. This only works for embedded images because it reads the width/height from image data. For non-embedded images, you can just set the desired display width and height directly.
- unconfined (bool) – Set unconfined=True to disable max-width confinement of the image.
- metadata (dict) – Specify extra metadata to attach to the image.
- alt (unicode) – Alternative text for the image, for use by screen readers.
From URL:
Image('https://www.google.fr/images/srpr/logo3w.png')
From file:
Image("./Ipython/dog.jpeg", width=200, height=200)
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.JSON
(data=None, url=None, filename=None, expanded=False, metadata=None, root='root', **kwargs)
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.
__init__(data=None, url=None, filename=None, expanded=False, metadata=None, root='root', **kwargs)¶
Create a JSON display object given raw data.
Parameters
- data (dict or list) – JSON data to display. Not an already-serialized JSON string. Scalar types (None, number, string) are not allowed, only dict or list containers.
- url (unicode) – A URL to download the data from.
- filename (unicode) – Path to a local file to load the data from.
- expanded (boolean) – Metadata to control whether a JSON display component is expanded.
- metadata (dict) – Specify extra metadata to attach to the json display object.
- root (str) – The name of the root element of the JSON tree
Using the GeoJSON file from above:
JSON("./Ipython/sample.geojson")
<IPython.core.display.JSON object>
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.Javascript
(data=None, url=None, filename=None, lib=None, css=None)
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) – The Javascript source code or a URL to download it from.
- url (unicode) – A URL to download the data from.
- filename (unicode) – Path to a local file to load the data from.
- lib (list or str) – A sequence of Javascript library URLs to load asynchronously before running the source code. The full URLs of the libraries should be given. A single Javascript library URL can also be given as a string.
- css (list or str) – A sequence of css files to load before running the source code. The full URLs of the css files should be given. A single css URL can also be given as a string.
JS passed directly:
Javascript("alert('Hello World!');")
From a file:
Javascript("./Ipython/sample.js", css="color: black;")
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
From a document:
Latex("./Ipython/latex.tex")
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.Markdown
(data=None, url=None, filename=None, metadata=None)
Passed directly:
Markdown("# Hello")
From file:
Markdown("./Ipython/markdown.txt")
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
%%capture
!pip install sympy
Math combined with sympy
: [SOURCE]
def printmd(string):
display(Markdown(string))
import sympy as sym
x = sym.symbols('x')
I = sym.integrate(1/(1+x**2), (x, 0, 1))
equation = r'$$\int_{{t=0}}^1 \frac{{1}}{{1+t^2}}\,\text{d}t$$'
printmd('**THE EQUATION:**')
printmd(f'{equation}')
printmd('**THE RESULT:**')
printmd(f'$$ = {sym.latex(I)}$$')
printmd('**COMBINED:**')
printmd(r'$$\int_{{t=0}}^1 \frac{{1}}{{1+t^2}}\,\text{d}t' + f' = {sym.latex(I)}$$')
printmd('**OR, COMBINED:**')
printmd(equation[:-2] + f' = {sym.latex(I)}$$') #alternative way to leave off right-side dollar signs
THE EQUATION:
THE RESULT:
COMBINED:
OR, COMBINED:
Math(rf'\int_{{t=0}}^1 \frac{{1}}{{1+t^2}}\,\text{{d}}t = ')
Math(rf'\int_{{t=0}}^1 \frac{{1}}{{1+t^2}}\,\text{{d}}t = {sym.latex(I)}')
Math(sym.latex(I))
sym.latex(I)
'\\frac{\\pi}{4}'
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
Documentation:
help(Pretty)
Help on class Pretty in module IPython.core.display: class Pretty(TextDisplayObject) | Pretty(data=None, url=None, filename=None, metadata=None) | | Method resolution order: | Pretty | TextDisplayObject | DisplayObject | builtins.object | | Methods inherited from DisplayObject: | | __init__(self, data=None, url=None, filename=None, metadata=None) | 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 | The raw data or a URL or file to load the data from | url : unicode | A URL to download the data from. | filename : unicode | Path to a local file to load the data from. | metadata : dict | Dict of metadata associated to be the object when displayed | | __repr__(self) | Return repr(self). | | reload(self) | Reload the raw data from file or URL. | | ---------------------------------------------------------------------- | Data descriptors inherited from DisplayObject: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes inherited from DisplayObject: | | metadata = None
DisplayObject(Pretty(url = "http://www.Google.com"))
<IPython.core.display.DisplayObject object>
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
help(ScribdDocument)
Help on class ScribdDocument in module IPython.lib.display: class ScribdDocument(IFrame) | ScribdDocument(id, width=400, height=300, **kwargs) | | 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") | | Method resolution order: | ScribdDocument | IFrame | builtins.object | | Methods defined here: | | __init__(self, id, width=400, height=300, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from IFrame: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes inherited from IFrame: | | iframe = '\n <iframe\n width="{width}"\n ...\n ...
ScribdDocument(71048089, width=800, height=400, start_page=3, view_mode="book")
ScribdDocument("71048089", width= '50%', height= 400, start_page= 5, view_mode= 'slideshow')
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.TextDisplayObject
(data=None, url=None, filename=None, metadata=None)
TextDisplayObject("http://www.google.com")
<IPython.core.display.TextDisplayObject object>
help(TextDisplayObject)
Help on class TextDisplayObject in module IPython.core.display: class TextDisplayObject(DisplayObject) | TextDisplayObject(data=None, url=None, filename=None, metadata=None) | | Validate that display data is text | | Method resolution order: | TextDisplayObject | DisplayObject | builtins.object | | Methods inherited from DisplayObject: | | __init__(self, data=None, url=None, filename=None, metadata=None) | 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 | The raw data or a URL or file to load the data from | url : unicode | A URL to download the data from. | filename : unicode | Path to a local file to load the data from. | metadata : dict | Dict of metadata associated to be the object when displayed | | __repr__(self) | Return repr(self). | | reload(self) | Reload the raw data from file or URL. | | ---------------------------------------------------------------------- | Data descriptors inherited from DisplayObject: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes inherited from DisplayObject: | | metadata = None
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
VimeoVideo("139304565", width= 400, height= 300)
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
IPython.display.YouTubeVideo
(id, width=400, height=300, allow_autoplay=False, **kwargs)
YouTubeVideo("gSVvxOchT8Y", start= 1800, autoplay= 1, width= 300, height= 300)
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |
.............................................................................
IPython.Display() Functions:
display_html(objs, *kwargs)
help(display_html)
Help on function display_html in module IPython.core.display: display_html(*objs, **kwargs) Display the HTML representation of an object. Note: If raw=False and the object does not have a HTML representation, no HTML will be shown. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw HTML data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associated with the specific mimetype output.
display_javascript(objs, *kwargs)
help(display_javascript)
Help on function display_javascript in module IPython.core.display: display_javascript(*objs, **kwargs) Display the Javascript representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw javascript data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associated with the specific mimetype output.
display_jpeg(objs, *kwargs)
help(display_jpeg)
Help on function display_jpeg in module IPython.core.display: display_jpeg(*objs, **kwargs) Display the JPEG representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw JPEG data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associated with the specific mimetype output.
display_json(objs, *kwargs)
help(display_json)
Help on function display_json in module IPython.core.display: display_json(*objs, **kwargs) Display the JSON representation of an object. Note that not many frontends support displaying JSON. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw json data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associated with the specific mimetype output.
display_latex(objs, *kwargs)
help(display_latex)
Help on function display_latex in module IPython.core.display: display_latex(*objs, **kwargs) Display the LaTeX representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw latex data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associated with the specific mimetype output.
display_markdown(objs, *kwargs)
help(display_markdown)
Help on function display_markdown in module IPython.core.display: display_markdown(*objs, **kwargs) Displays the Markdown representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw markdown data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associated with the specific mimetype output.
display_pdf(objs, *kwargs)
help(display_pdf)
Help on function display_pdf in module IPython.core.display: display_pdf(*objs, **kwargs) Display the PDF representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw javascript data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associated with the specific mimetype output.
display_png(objs, *kwargs)
help(display_png)
Help on function display_png in module IPython.core.display: display_png(*objs, **kwargs) Display the PNG representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw png data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associated with the specific mimetype output.
display_pretty(objs, *kwargs)
help(display_pretty)
Help on function display_pretty in module IPython.core.display: display_pretty(*objs, **kwargs) Display the pretty (default) representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw text data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associated with the specific mimetype output.
display_svg(objs, *kwargs)
help(display_svg)
Help on function display_svg in module IPython.core.display: display_svg(*objs, **kwargs) Display the SVG representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw svg data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associated with the specific mimetype output.
publish_display_data(data, metadata=None, source=
help(publish_display_data)
Help on function publish_display_data in module IPython.core.display: publish_display_data(data, metadata=None, source=None, *, transient=None, **kwargs) Publish data and metadata to all frontends. See the ``display_data`` message in the messaging documentation for more details about this message type. Keys of data and metadata can be any mime-type. Parameters ---------- data : dict A dictionary having keys that are valid MIME types (like 'text/plain' or 'image/svg+xml') and values that are the data for that MIME type. The data itself must be a JSON'able data structure. Minimally all data should have the 'text/plain' data, which can be displayed by all frontends. If more than the plain text is given, it is up to the frontend to decide which representation to use. metadata : dict A dictionary for metadata related to the data. This can contain arbitrary key, value pairs that frontends can use to interpret the data. mime-type keys matching those in data can be used to specify metadata about particular representations. source : str, deprecated Unused. transient : dict, keyword-only A dictionary of transient data, such as display_id.
set_matplotlib_close(close=True)
help(set_matplotlib_close)
Help on function set_matplotlib_close in module IPython.core.display: set_matplotlib_close(close=True) .. deprecated:: 7.23 use `matplotlib_inline.backend_inline.set_matplotlib_close()` 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 Should all matplotlib figures be automatically closed after each cell is run?
set_matplotlib_formats(formats, *kwargs)
help(set_matplotlib_formats)
Help on function set_matplotlib_formats in module IPython.core.display: set_matplotlib_formats(*formats, **kwargs) .. deprecated:: 7.23 use `matplotlib_inline.backend_inline.set_matplotlib_formats()` 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 One or more figure formats to enable: 'png', 'retina', 'jpeg', 'svg', 'pdf'. **kwargs : Keyword args will be relayed to ``figure.canvas.print_figure``.
update_display(obj, , display_id, *kwargs)
help(update_display)
Help on function update_display in module IPython.core.display: update_display(obj, *, display_id, **kwargs) Update an existing display by id Parameters ---------- obj: The object with which to update the display display_id: keyword-only The id of the display to update See Also -------- :func:`display`
Jump to: Top | Audio | Code | DisplayObject | FileLink | FileLinks | GeoJSON |
| HTML | IFrame | Image | JSON | Javascript | Latex | Markdown |
Math | Pretty |
| ScribdDocument | TextDisplayObject | VimeoVideo| YouTubeVideo | Functions |