MkDocs plugin to add plotly charts from plotly's json data
Project description
Mkdocs Plotly Plugin
MkDocs plugin to create interactive charts from data using the declarative plotly's json syntax.
Includes supports for mkdocs-material theme features like instant loading and dark color themes.
Installation
Install the plugin using pip3
:
pip install mkdocs-plotly-plugin
And then add the plugin into plugins
and the custome fence
plugins:
- plotly
markdown_extensions:
- pymdownx.superfences:
custom_fences:
- name: plotly
class: plotly
format: !!python/name:mkdocs_plotly_plugin.fences.fence_plotly
Usage
You can insert any valid plotly JSON as a codeblock using:
``` plotly
{
"data": [
{
"x": [
"giraffes",
"orangutans",
"monkeys"
],
"y": [
20,
14,
23
],
"type": "bar"
}
]
}
```
This is compatiable with snipplets
as well
```plotly
--8<-- "assets/data.json"
```
or you can insert any plotly JSON through URLs
```plotly
{"file_path": "./assets/data.json"}
```
Using snipplets
will insert the json content into the output HTML file, which is more suitable for smaller datasets. Using file_path
will fetch the json content once the page is loaded.
Plotly has its own eco-system for creating charts in most statistical languages. You can output the plot as a json file through fig.to_json()
.
Options
Option | Default | Description |
---|---|---|
lib_path | |
Relative path to local plotly.js file, or leave it blank to use CDN. |
template_default | plotly |
template for plotly charts in light mode |
template_slate | plotly_dark |
template for plotly charts in dark mode |
enable_template | True | use template to automatically change theme |
Available Plotly templates are ["plotly", "plotly_white", "plotly_dark", "ggplot2", "seaborn", "simple_white", "none"]
. If you want to customize your own template, you can export it as a JSON file and provide its relative path in options.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mkdocs-plotly-plugin-0.0.2.tar.gz
.
File metadata
- Download URL: mkdocs-plotly-plugin-0.0.2.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b4069d0b94eab7f857f18f3013c7ee476991bf90d229898496665c693f43dbe |
|
MD5 | bae3c5124bd3286197bbddfc64445491 |
|
BLAKE2b-256 | f134a7da06a3e21430336b075390d483649187666755d172a02f50ee9fd067cd |
File details
Details for the file mkdocs_plotly_plugin-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: mkdocs_plotly_plugin-0.0.2-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9fb0b77319bc71b4cbb764a3900c15e551596d76381a03acc116d214cb53250 |
|
MD5 | 956f9b524d008233a6284df923bac41b |
|
BLAKE2b-256 | fc1cd87bac347f11ca889b4566f92046d718adca3797b617e947cde416f65819 |