Skip to main content

A background data server for Altair charts.

Project description

Altair Viewer

Offline chart viewer for Altair visualizations

github actions github actions code style black

This package provides tools for viewing Altair charts without a web connection in arbitrary Python environments. Charts can be displayed either inline in a Jupyter notebook environment, or in a separate browser window for use in any environment.

Altair Viewer Gif

Installation

The development version of Altair-viewer can be installed with pip:

$ pip install git+http://github.com/altair-viz/altair_viewer.git

Usage: General Environments

Altair viewer provides two top-level functions for displaying charts: altair_viewer.display() and altair_viewer.show(). Their use is slightly different:

  • altair_viewer.display(chart) is meant for use in interactive computing environments where a single Python process is used interactively. It will serve a chart viewer at a localhost URL, and any susequent chart created within the session will appear in the same window. The background server will be terminated when the main Python process terminates, so this is not suitable for standalone scripts.

  • altair_viewer.show(chart) is meant for use once at the end of a script. It does the same as display(), but automatically opens a browser window, and adds an input prompt to prevent the script (and the server it creates) from terminating.

Usage: IPython & Jupyter

Within Jupyter notebook, IPython notebook, and related environments that support Mimetype-based display, altair viewer can be used by enabling the altair_viewer renderer:

import altair as alt
alt.renderers.enable('altair_viewer')

This will cause charts at the end of a Jupyter notebook cell to be rendered in a separate browser window, as with the display() and show() methods.

If enabled with inline=True, charts will be rendered inline in the notebook:

import altair as alt
alt.renderers.enable('altair_viewer', inline=True)

To display a single chart using Altair viewer in an IPython environment without globally enabling the associated renderer, you can use the display method:

import altair_viewer
altair_viewer.display(chart, inline=True)

Note that the display based on altair viewer will only function correctly as long as the Kernel that created the charts is active, as it depends on the background server started by the kernel. In particular, this means that if you save a notebook and reopen it later, charts will not display until the associated cells are re-run.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

altair_viewer-0.1.0.tar.gz (275.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

altair_viewer-0.1.0-py3-none-any.whl (276.7 kB view details)

Uploaded Python 3

File details

Details for the file altair_viewer-0.1.0.tar.gz.

File metadata

  • Download URL: altair_viewer-0.1.0.tar.gz
  • Upload date:
  • Size: 275.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191203 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

File hashes

Hashes for altair_viewer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39971db48dbc2b1bda531e92a91a15c53cadf89b2b25dd36ea06206b4fffa2b5
MD5 5c25fb2d907f0d790bf8cba98fe55b32
BLAKE2b-256 ad81851a2c4fccb7263ddd914856668cd399d94ba0cce0ecf297a1dd661aab7c

See more details on using hashes here.

File details

Details for the file altair_viewer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: altair_viewer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 276.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191203 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

File hashes

Hashes for altair_viewer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfaee817cd67ed7aa1ee4060b49ee2f3e5c00f1d7e116846974f4f64a0449316
MD5 a6c47a8e8983ff389c358a51510dd622
BLAKE2b-256 373d9904b9ac326c91739e47c3372d931ecccdecfadb67ef3e5bd4e4cc929047

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page