altair-viewer


Namealtair-viewer JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttp://github.com/altair-viz/altair_viewer/
SummaryViewer for Altair and Vega-Lite visualizations.
upload_time2021-11-06 14:16:11
maintainer
docs_urlNone
authorJake VanderPlas
requires_python>=3.6
licenseBSD 3-clause
keywords
VCS
bugtrack_url
requirements altair altair_data_server
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Altair Viewer
Offline chart viewer for [Altair](http://altair-viz.github.io) visualizations

[![github actions](https://github.com/altair-viz/altair_viewer/workflows/build/badge.svg)](https://github.com/altair-viz/altair_viewer/actions?query=workflow%3Abuild)
[![github actions](https://github.com/altair-viz/altair_viewer/workflows/lint/badge.svg)](https://github.com/altair-viz/altair_viewer/actions?query=workflow%3Alint)
[![code style black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/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](https://raw.githubusercontent.com/altair-viz/altair_viewer/master/images/viewer.gif)

## Installation
Altair Viewer can be installed from the
[Python Package Index](http://pypi.org/project/altair_viewer) with ``pip``:
```
$ pip install altair_viewer
```

## Usage: General Environments
Altair viewer provides two top-level functions for displaying charts: ``display()`` and ``show()``.
Their intended use is slightly different:
```python
import altair_viewer
altair_viewer.display(chart)
```
``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.

```python
import altair_viewer
altair_viewer.show(chart)
```
``show(chart)`` is meant for use once at the end of a Python 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 terminal, and related environments that support
[Mimetype-based display](https://jupyterlab.readthedocs.io/en/stable/user/file_formats.html),
altair viewer can be used by enabling the ``altair_viewer`` renderer:
```python
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:
```python
import altair as alt
alt.renderers.enable('altair_viewer', inline=True)
```

To display a single inline chart using Altair viewer in an IPython environment without
globally enabling the associated renderer, you can use the ``display`` method directly:
```python
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 running, 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.



            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/altair-viz/altair_viewer/",
    "name": "altair-viewer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jake VanderPlas",
    "author_email": "jakevdp@google.com",
    "download_url": "https://files.pythonhosted.org/packages/9e/55/976c41be000f996978ddd48d304939515ed00a160b669c819cc3b6d068c9/altair_viewer-0.4.0.tar.gz",
    "platform": "",
    "description": "# Altair Viewer\nOffline chart viewer for [Altair](http://altair-viz.github.io) visualizations\n\n[![github actions](https://github.com/altair-viz/altair_viewer/workflows/build/badge.svg)](https://github.com/altair-viz/altair_viewer/actions?query=workflow%3Abuild)\n[![github actions](https://github.com/altair-viz/altair_viewer/workflows/lint/badge.svg)](https://github.com/altair-viz/altair_viewer/actions?query=workflow%3Alint)\n[![code style black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nThis package provides tools for viewing Altair charts without a web connection in arbitrary Python\nenvironments. Charts can be displayed either inline in a Jupyter notebook environment, or in a\nseparate browser window for use in any environment.\n\n![Altair Viewer Gif](https://raw.githubusercontent.com/altair-viz/altair_viewer/master/images/viewer.gif)\n\n## Installation\nAltair Viewer can be installed from the\n[Python Package Index](http://pypi.org/project/altair_viewer) with ``pip``:\n```\n$ pip install altair_viewer\n```\n\n## Usage: General Environments\nAltair viewer provides two top-level functions for displaying charts: ``display()`` and ``show()``.\nTheir intended use is slightly different:\n```python\nimport altair_viewer\naltair_viewer.display(chart)\n```\n``display(chart)`` is meant for use in interactive computing environments where\na single Python process is used interactively. It will serve a chart viewer at a localhost\nURL, and any susequent chart created within the session will appear in the same window.\nThe background server will be terminated when the main Python process terminates, so this\nis not suitable for standalone scripts.\n\n```python\nimport altair_viewer\naltair_viewer.show(chart)\n```\n``show(chart)`` is meant for use once at the end of a Python script. It does the\nsame as ``display()``, but automatically opens a browser window, and adds an input\nprompt to prevent the script (and the server it creates) from terminating.\n\n## Usage: IPython & Jupyter\nWithin Jupyter notebook, IPython terminal, and related environments that support\n[Mimetype-based display](https://jupyterlab.readthedocs.io/en/stable/user/file_formats.html),\naltair viewer can be used by enabling the ``altair_viewer`` renderer:\n```python\nimport altair as alt\nalt.renderers.enable('altair_viewer')\n```\nThis will cause charts at the end of a Jupyter notebook cell to be rendered in a\nseparate browser window, as with the ``display()`` and ``show()`` methods.\n\nIf enabled with ``inline=True``, charts will be rendered inline in the notebook:\n```python\nimport altair as alt\nalt.renderers.enable('altair_viewer', inline=True)\n```\n\nTo display a single inline chart using Altair viewer in an IPython environment without\nglobally enabling the associated renderer, you can use the ``display`` method directly:\n```python\nimport altair_viewer\naltair_viewer.display(chart, inline=True)\n```\n\nNote that the display based on altair viewer will only function correctly as long as the\nkernel that created the charts is running, as it depends on the background server started\nby the kernel. In particular, this means that if you save a notebook and reopen it later,\ncharts will not display until the associated cells are re-run.\n\n\n",
    "bugtrack_url": null,
    "license": "BSD 3-clause",
    "summary": "Viewer for Altair and Vega-Lite visualizations.",
    "version": "0.4.0",
    "project_urls": {
        "Download": "http://github.com/altair-viz/altair_viewer/",
        "Homepage": "http://github.com/altair-viz/altair_viewer/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f1e60890752f10ba12cfff4d6a86771e4881d259b735fb6f4de9a34f4a0b0874",
                "md5": "413e041531348a76f94c08a4b35e25e7",
                "sha256": "5da49c52ad9fc56b823cc479b8e5332324d1544b3f7ae4939c25a8585eae5245"
            },
            "downloads": -1,
            "filename": "altair_viewer-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "413e041531348a76f94c08a4b35e25e7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 844548,
            "upload_time": "2021-11-06T14:16:09",
            "upload_time_iso_8601": "2021-11-06T14:16:09.717656Z",
            "url": "https://files.pythonhosted.org/packages/f1/e6/0890752f10ba12cfff4d6a86771e4881d259b735fb6f4de9a34f4a0b0874/altair_viewer-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9e55976c41be000f996978ddd48d304939515ed00a160b669c819cc3b6d068c9",
                "md5": "fe5febc91ddff5833903a897656e5208",
                "sha256": "f5d33df775cb9094544f15e9b5788224488f506cf546c708980d2d44c2f93534"
            },
            "downloads": -1,
            "filename": "altair_viewer-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fe5febc91ddff5833903a897656e5208",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 841463,
            "upload_time": "2021-11-06T14:16:11",
            "upload_time_iso_8601": "2021-11-06T14:16:11.980116Z",
            "url": "https://files.pythonhosted.org/packages/9e/55/976c41be000f996978ddd48d304939515ed00a160b669c819cc3b6d068c9/altair_viewer-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-11-06 14:16:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "altair-viz",
    "github_project": "altair_viewer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "altair",
            "specs": []
        },
        {
            "name": "altair_data_server",
            "specs": [
                [
                    ">=",
                    "0.4.0"
                ]
            ]
        }
    ],
    "lcname": "altair-viewer"
}
        
Elapsed time: 0.25485s