Metadata-Version: 2.1
Name: sphinx-plotly-directive
Version: 0.1.1
Summary: A directive for including a plotly figure in a Sphinx document
Home-page: https://github.com/harupy/sphinx-plotly-directive
Maintainer: harupy
Maintainer-email: hkawamura0130@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: plotly
Requires-Dist: pandas
Provides-Extra: dev
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: black ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: sphinx (==3.0.4) ; extra == 'dev'
Requires-Dist: sphinx-rtd-theme ; extra == 'dev'

# sphinx-plotly-directive

[![pypi badge](https://img.shields.io/pypi/v/sphinx-plotly-directive?color=blue)](https://pypi.org/project/sphinx-plotly-directive/)
![CI](https://github.com/harupy/sphinx-plotly-directive/workflows/CI/badge.svg)
[![Documentation Status](https://readthedocs.org/projects/sphinx-plotly-directive/badge/?version=latest)](https://sphinx-plotly-directive.readthedocs.io/en/latest/?badge=latest)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

A directive for including a Plotly figure in a Sphinx document.

_**Based on [matplotlib's plot directive](https://matplotlib.org/3.1.1/devel/plot_directive.html).**_

## Install

```bash
# pypi
pip install sphinx-plotly-directive

# dev version
pip install git+https://github.com/harupy/sphinx-plotly-directive.git
```

## Usage

#### Source:

```
.. plotly::

   import plotly.express as px
   px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])
```

The last line of a code block must end with an expression that evaluates to a plotly figure.

#### Output:

<img src="https://user-images.githubusercontent.com/17039389/96469067-c3275b80-1267-11eb-89b5-4370e945ac2c.png" width="80%" />

See [documentation](https://sphinx-plotly-directive.readthedocs.io/en/latest/index.html) for details.

## Development

### Install dependencies

```
pip install -e ".[dev]"
```

### Format code

```
flake8 .
isort .
black .
```

### Run tests

```
pytest tests
```

### Build document

```
cd docs
make html
```


