An open API service indexing awesome lists of open source software.

https://github.com/itsluketwist/plotly-utils

Some simple patterns/defaults that I like to use alongside Plotly.
https://github.com/itsluketwist/plotly-utils

graphing plotly

Last synced: 3 months ago
JSON representation

Some simple patterns/defaults that I like to use alongside Plotly.

Awesome Lists containing this project

README

        

# **plotly-utils**

![check code workflow](https://github.com/itsluketwist/plotly-utils/actions/workflows/check.yaml/badge.svg)





MIT License


Python 3


Plotly

## *usage*

Some simple patterns/defaults that I like to use alongside Plotly (my chosen graphing library).

Requires plotly (obviously), once installed just import into your code and use,
mostly alongside the `graph_objects` module.

```python
from random import randint

import plotly.graph_objects as go

from plotly_utils import default_figure, write_and_display

figure = default_figure(
title="New Example Graph",
data=go.Scatter(
x=list(range(10)),
y=[randint(1, 5) for _ in range(10)],
mode="lines+markers"
)
)

write_and_display(
figure=figure,
name="example",
)

```

![Example Graph](assets/example.png)

## *installation*

Install directly from GitHub, using pip:

```shell
pip install git+https://github.com/itsluketwist/plotly-utils
```

## *development*

Clone the repository code:

```shell
git clone https://github.com/itsluketwist/plotly-utils.git
```

Once cloned, install the package locally in a virtual environment:

```shell
python -m venv venv

. venv/bin/activate

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

Install and use pre-commit to ensure code is in a good state:

```shell
pre-commit install

pre-commit autoupdate

pre-commit run --all-files
```