Plotly.js
Open-source JavaScript charting library behind Plotly and Dash
README
Table of contents
Load as a node module
- ```sh
- npm i --save plotly.js-dist-min
- ```
- ``` js
- // ES6 module
- import Plotly from 'plotly.js-dist-min'
- // CommonJS
- var Plotly = require('plotly.js-dist-min')
- ```
Load via script tag
The script HTML element
In the examples below Plotly object is added to the window scope by script. The newPlot method is then used to draw an interactive figure as described by data and layout into the desired div here named gd. As demonstrated in the example above basic knowledge of html and JSON syntax is enough to get started i.e. with/without JavaScript! To learn and build more with plotly.js please visit plotly.js documentation.
- ``` html
- <head>
- <script src="https://cdn.plot.ly/plotly-2.16.3.min.js"></script>
- </head>
- <body>
- <div id="gd"></div>
- <script>
- Plotly.newPlot("gd", /* JSON object */ {
- "data": [{ "y": [1, 2, 3] }],
- "layout": { "width": 600, "height": 400}
- })
- </script>
- </body>
- ```
- ``` html
- <script type="module">
- import "https://cdn.plot.ly/plotly-2.16.3.min.js"
- Plotly.newPlot("gd", [{ y: [1, 2, 3] }])
- </script>
- ```
Un-minified versions are also available on CDN
- ``` html
- <script src="https://cdn.plot.ly/plotly-2.16.3.js" charset="utf-8"></script>
- ```
Please note that as of v2 the "plotly-latest" outputs (e.g. https://cdn.plot.ly/plotly-latest.min.js) will no longer be updated on the CDN, and will stay at the last v1 patch v1.58.5. Therefore, to use the CDN with plotly.js v2 and higher, you must specify an exact plotly.js version.
MathJax
- ``` html
- <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG.js"></script>
- ```
- ``` html
- <script src="https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-svg.js"></script>
- ```
When using MathJax version 3, it is also possible to use chtml output on the other parts of the page in addition to svg output for the plotly graph.
Bundles
Alternative ways to load and build plotly.js
Documentation
Bugs and feature requests
Contributing
Notable contributors
| | Status | |
---|---|---|
|---|--------|---------|--------| | ||
|**Alex | [@alexcjohnson](https://github.com/alexcjohnson) | | |
|**Mojtaba | [@archmoj](https://github.com/archmoj) | [@solarchvision](https://twitter.com/solarchvision) |
|**Antoine | [@antoinerg](https://github.com/antoinerg) | | |
|**Nicolas | [@nicolaskruchten](https://github.com/nicolaskruchten) | [@nicolaskruchten](https://twitter.com/nicolaskruchten) |
|**Jon | [@jonmmease](https://github.com/jonmmease) | [@jonmmease](https://twitter.com/jonmmease) |
|**Étienne | [@etpinard](https://github.com/etpinard) | [@etpinard](https://twitter.com/etpinard) |
|**Mikola | [@mikolalysenko](https://github.com/mikolalysenko) | [@MikolaLysenko](https://twitter.com/MikolaLysenko) |
|**Ricky | [@rreusser](https://github.com/rreusser) | [@rickyreusser](https://twitter.com/rickyreusser) |
|**Dmitry | [@dy](https://github.com/dy) | [@DimaYv](https://twitter.com/dimayv)| |
|**Robert | [@monfera](https://github.com/monfera) | [@monfera](https://twitter.com/monfera) |
|**Robert | [@rmoestl](https://github.com/rmoestl) | [@rmoestl](https://twitter.com/rmoestl) |
|**Nicolas | [@n-riesco](https://github.com/n-riesco) | | |
|**Miklós | [@mdtusz](https://github.com/mdtusz) | [@mdtusz](https://twitter.com/mdtusz)| |
|**Chelsea | [@cldougl](https://github.com/cldougl) | | |
|**Ben | [@bpostlethwaite](https://github.com/bpostlethwaite) | | |
|**Chris | [@chriddyp](https://github.com/chriddyp) | | |
|**Alex | [@alexander-daniel](https://github.com/alexander-daniel) | | |