Skip to content

Commit

Permalink
Add support for Bokeh and Plotly (#15)
Browse files Browse the repository at this point in the history
* Add support for Bokeh and Plotly
  • Loading branch information
domvwt authored Apr 23, 2021
1 parent a3c2e7b commit 5d5b0c4
Show file tree
Hide file tree
Showing 24 changed files with 13,098 additions and 172 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Scratch files for testing
scratch.ipynb
scratch.py
esparto-page-*.html
notebooks/*.jpg
esparto-doc.html
docs/examples/*.html

# IDE files
.vscode
Expand Down
16 changes: 13 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
sudo: false
language: python
os: linux
dist: xenial
python:
- 3.9
- 3.8
- 3.7
- 3.6

env:
- INSTALL_DEPS=""
- INSTALL_DEPS="--no-dev"

before_install:
- pip install poetry
- curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
- python get-poetry.py -y
- export PATH="$PATH:$HOME/.poetry/bin"
- poetry config virtualenvs.in-project true

install:
- poetry install
- poetry install $INSTALL_DEPS -E test

script:
- black --check .
- flake8
- coverage run --source esparto -m pytest
- mypy esparto tests
- coverage run --append --source esparto -m pytest

after_success:
- bash <(curl -s https://codecov.io/bash)
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ mypy: ## check type hints

test: ## run tests quickly with the default Python
pytest
python -m tests.check_package_version

test-all: ## run tests on every Python version with tox
tox
tox --skip-missing-interpreters
python -m tests.check_package_version

coverage: ## check code coverage quickly with the default Python
coverage run --source esparto -m pytest
Expand Down
2 changes: 1 addition & 1 deletion docs/01-getting-started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ Esparto determines that the string points to a valid image and loads the file:

<br>

Please check the [examples page](../02-user-guide/examples.md) for a more in-depth guide.
Please see the [examples page](../02-user-guide/examples.md) for more.

<br>
26 changes: 22 additions & 4 deletions docs/02-user-guide/examples.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
# Examples

### Data Analysis Report
### Data Analysis

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/domvwt/esparto/blob/main/docs/examples/iris.ipynb)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/domvwt/esparto/main?filepath=docs%2Fexamples%2Firis.ipynb)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/domvwt/esparto/blob/main/docs/examples/iris-report.ipynb)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/domvwt/esparto/main?filepath=docs%2Fexamples%2Firis-report.ipynb)

The iris dataset is one of the most well known datasets in statistics and data science. This example notebook shows how we can put together a simple data analysis report in esparto.

This example covers
This example covers:

* Text content with markdown formatting
* Including images from files
* Converting a Pandas DataFrame to a table
* Adding plots from Matplotlib and Seaborn

<br>

### Interactive Plotting

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/domvwt/esparto/blob/main/docs/examples/interactive-plots.ipynb)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/domvwt/esparto/main?filepath=docs%2Fexamples%2Finteractive-plots.ipynb)

The [pandas-bokeh](https://github.com/PatrikHlobil/Pandas-Bokeh) library offers convenient functions for producing interactive Bokeh plots
with few lines of code.

With the [Plotly backend for Pandas](https://plotly.com/python/pandas-backend/)
we can access the Plotly Express API directly from the '.plot()' method of any DataFrame or Series.

This example will show basic examples from each library:

* Interactive plotting with Bokeh and Plotly
* Adding interactive content to the page

<br>
13 changes: 10 additions & 3 deletions docs/03-api-reference/adaptors.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
!!! info
The ```content_adaptor``` is called internally when an explicit Content class is not provided.

Input objects are matched to a suitable Content class through [_single dispatch_](https://docs.python.org/3/library/functools.html#functools.singledispatch).

``` python
import esparto as es

# Create some new Markdown text
markdown = es.Markdown("Example _markdown_ text.")

# Text automatically converted to Markdown content.
section = es.Section()
section += "Example _markdown_ text."
print(section)
```
```
{'Section': [{'Row': [{'Column': ['Markdown']}]}]}
```


## ::: esparto._adaptors

Expand Down
4 changes: 4 additions & 0 deletions docs/03-api-reference/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@

## ::: esparto._content.FigureMpl

## ::: esparto._content.FigureBokeh

## ::: esparto._content.FigurePlotly

<br>
Loading

0 comments on commit 5d5b0c4

Please sign in to comment.