This package has been deprecated

Author message:

This package is being deprecated. Please use the Plotly-supported jupyterlab-plotly (https://www.npmjs.com/package/jupyterlab-plotly). See the plotly.py README for more info: https://github.com/plotly/plotly.py#jupyterlab-support-python-35

@jupyterlab/plotly-extension
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

plotly-extension

A JupyterLab extension for rendering Plotly charts

demo

Requirements

  • JupyterLab ^0.30.0
  • Node.js >= 5
  • plotly.py >= 2.0.0 (optional)

Install

jupyter labextension install @jupyterlab/plotly-extension

Usage

To render Plotly JSON in IPython:

from IPython.display import display

def Plotly(data=[], layout={}):
    bundle = {}
    bundle['application/vnd.plotly.v1+json'] = {
        'data': data,
        'layout': layout,
    }
    display(bundle, raw=True)

data = [
    {'x': [1999, 2000, 2001, 2002], 'y': [10, 15, 13, 17], 'type': 'scatter'},
    {'x': [1999, 2000, 2001, 2002], 'y': [16, 5, 11, 9], 'type': 'scatter'}
]

layout = {
    'title': 'Sales Growth',
    'xaxis': {'title': 'Year', 'showgrid': False, 'zeroline': False},
    'yaxis': {'title': 'Percent', 'showline': False}
}

Plotly(data, layout)

To render using the plotly Python library:

import plotly
from plotly.offline import iplot

trace = plotly.graph_objs.Heatmap(z=[[1, 20, 30],
                      [20, 1, 60],
                      [30, 60, 1]])

fig = dict(data=[trace])

iplot(fig)

To render a .plotly or .plotly.json file, simply open it.

Contributing

Install

The jlpm command is JupyterLab's pinned version of yarn that is installed with JupyterLab. You may use yarn or npm in lieu of jlpm below.

# Clone the repo to your local environment
git clone https://github.com/jupyterlab/jupyter-renderers.git
cd jupyter-renderers
# Install dependencies
jlpm
# Build Typescript source
jlpm build
# Link your development version of the extension with JupyterLab
jupyter labextension link packages/plotly-extension
# Rebuild Typescript source after making changes
jlpm build
# Rebuild JupyterLab after making any changes
jupyter lab build

You can watch the jupyter-renderers directory and run JupyterLab in watch mode to watch for changes in the extension's source and automatically rebuild the extension and application.

# Run jupyterlab in watch mode in one terminal tab
jupyter lab --watch
# Watch the jupyter-renderers directory in another terminal tab
jlpm watch

Uninstall

jupyter labextension uninstall @jupyterlab/plotly-extension

Package Sidebar

Install

npm i @jupyterlab/plotly-extension

Weekly Downloads

21

Version

1.0.0

License

BSD-3-Clause

Unpacked Size

12.4 kB

Total Files

7

Last publish

Collaborators

  • hbcarlos
  • jupyter-server-release-bot
  • jupyterlab-release-bot
  • jweill-aws
  • krassowski
  • darian
  • blink1073
  • jasongrout
  • sylvaincorlay
  • ian-r-rose
  • minrk
  • hoo761
  • zsailer
  • telamonian
  • fcollonval
  • jtpio
  • echarles
  • goanpeca
  • mbektas
  • loichuder