Metadata-Version: 2.2
Name: figlinq
Version: 0.14.0
Summary: Utilities for interfacing with Plotly's Chart Studio and figlinq.com
Home-page: https://github.com/figlinq/figlinq
Author: figlinq.com
Author-email: info@figlinq.com
Maintainer: figlinq.com
Maintainer-email: info@figlinq.com
License: MIT
Project-URL: Github, https://github.com/figlinq/figlinq
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Visualization
Description-Content-Type: text/markdown
Requires-Dist: plotly>=5.24.1
Requires-Dist: requests>=2.30.0
Requires-Dist: six
Requires-Dist: cairosvg
Requires-Dist: numpy
Requires-Dist: pandas
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: maintainer
Dynamic: maintainer-email
Dynamic: project-url
Dynamic: requires-dist
Dynamic: summary

# Figlinq Python Library

This package contains utilities for interfacing with Plotly's Chart Studio and Figlinq services. The project has been cloned from [chart-studio 1.1.0](https://pypi.org/project/chart-studio/). The original package has been modified so that credentials and configuration can be set from environment variables (see `figlinq.tools.get_credentials()` and `figlinq.tools.get_config()`). Additional functions have been added to support the Figlinq service. The original package is licensed under the MIT license, and this package is also licensed under the MIT license.

## Installation

```bash
pip install figlinq
```

## Editing figures: figlinq.open_figure

`figlinq.open_figure(fid)` edits a Figlinq figure (a multi-panel page of plots, images and text) from Python. All its methods are coroutines, so use `await` (in a script, `asyncio.run(main())`).

```python
import figlinq

fig = figlinq.open_figure("alice:12")      # the figure's fid
state = await fig.state()                  # read first: page, layers, nodes, selection
await fig.add_content(["alice:12", "alice:15"], layout={"type": "grid", "cols": 2})
await fig.modify_plots(fids=["alice:12"], layout={"title": {"text": "Growth"}}, traceActions=["no_modify"])

async with fig.batch() as b:               # several operations, all or none
    t = b.add_text("A", 10, 10)            # a Ref to the new text's id
    b.align([t], "left")
img = await fig.image()                    # a PNG of the page
```

In a script or a plain Python session every call goes to the server and is stored at once as one revision of the figure. It is guarded by the figure's ETag, so a figure that changed in the meantime raises `VersionConflict`: read `state()` again. Inside the Figlinq web app (Flows, the assistant) with the figure open in the editor, the changes are live in the editor and are not saved until the user saves. `modify_plots` rewrites the plot files at once on both. Errors are subclasses of `figlinq.FigureEditorError` (`figlinq.figure_editor.VersionConflict`, `ReadOnly`, `NotFound`, `PermissionDenied`, ...) with a `.code`. See the docstring of `figlinq.figure_editor` for the full list of operations.
