|
| 1 | +# plotly.py |
| 2 | + |
| 3 | +<table> |
| 4 | + <tr> |
| 5 | + <td>Latest Release</td> |
| 6 | + <td> |
| 7 | + <a href="https://pypi.org/project/plotly/"/> |
| 8 | + <img src="https://badge.fury.io/py/plotly.svg"/> |
| 9 | + </td> |
| 10 | + </tr> |
| 11 | + <tr> |
| 12 | + <td>PyPI Downloads</td> |
| 13 | + <td> |
| 14 | + <a href="https://pepy.tech/project/plotly"/> |
| 15 | + <img src="https://pepy.tech/badge/plotly/month"/> |
| 16 | + </td> |
| 17 | + </tr> |
| 18 | + <tr> |
| 19 | + <td>License</td> |
| 20 | + <td> |
| 21 | + <a href="https://opensource.org/licenses/MIT"/> |
| 22 | + <img src="https://img.shields.io/badge/License-MIT-yellow.svg"/> |
| 23 | + </td> |
| 24 | + </tr> |
| 25 | +</table> |
| 26 | + |
| 27 | +## Quickstart |
| 28 | + |
| 29 | +`pip install plotly "notebook>=5.3" "ipywidgets>=7.2"` |
| 30 | + |
| 31 | +Inside [Jupyter notebook](https://jupyter.org/install): |
| 32 | +```python |
| 33 | +import plotly.graph_objs as go |
| 34 | +fig = go.FigureWidget() |
| 35 | +# Display an empty figure |
| 36 | +fig |
| 37 | +``` |
| 38 | +```python |
| 39 | +# Add a scatter chart |
| 40 | +fig.add_scatter(y=[2, 1, 4, 3]) |
| 41 | +# Add a bar chart |
| 42 | +fig.add_bar(y=[1, 4, 3, 2]) |
| 43 | +# Add a title |
| 44 | +fig.layout.title = 'Hello FigureWidget' |
| 45 | +``` |
| 46 | + |
| 47 | +See the [Python documentation](https://plot.ly/python/) for more examples. |
| 48 | + |
| 49 | +Read about what's new in [plotly.py v3](https://medium.com/@plotlygraphs/introducing-plotly-py-3-0-0-7bb1333f69c6) |
| 50 | + |
| 51 | +## Overview |
| 52 | +[plotly.py](https://plot.ly/d3-js-for-python-and-pandas-charts/) is an interactive, open-source, and browser-based graphing library for Python :sparkles: |
| 53 | + |
| 54 | +Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is a high-level, declarative charting library. plotly.js ships with over 30 chart types, including scientific charts, 3D graphs, statistical charts, SVG maps, financial charts, and more. |
| 55 | + |
| 56 | +`plotly.py` is [MIT Licensed](packages/python/chart-studio/LICENSE.txt). Plotly graphs can be viewed in Jupyter notebooks, standalone HTML files, or hosted online on [plot.ly](https://plot.ly). |
| 57 | + |
| 58 | +[Contact us](https://plot.ly/products/consulting-and-oem/) for Plotly.js consulting, dashboard development, application integration, and feature additions. Sharing your graphs online or in dashboards? Consider a [plot.ly subscription](https://plot.ly/products/cloud). |
| 59 | + |
| 60 | +<p align="center"> |
| 61 | + <a href="https://plot.ly/python" target="_blank"> |
| 62 | + <img src="https://raw.githubusercontent.com/cldougl/plot_images/add_r_img/plotly_2017.png"> |
| 63 | +</a></p> |
| 64 | + |
| 65 | +*** |
| 66 | + |
| 67 | +- [Online Documentation](https://plot.ly/python) |
| 68 | +- [Contributing](contributing.md) |
| 69 | +- [Changelog](packages/python/plotly-geo/CHANGELOG.md) |
| 70 | +- [Code of Conduct](CODE_OF_CONDUCT.md) |
| 71 | +- [Version 3 Migration Guide](migration-guide.md) |
| 72 | +- [New! Announcing Dash](https://medium.com/@plotlygraphs/introducing-dash-5ecf7191b503) |
| 73 | +- [Community](https://community.plot.ly/c/api/python) |
| 74 | + |
| 75 | +*** |
| 76 | + |
| 77 | +## Installation |
| 78 | + |
| 79 | +plotly.py may be installed using pip... |
| 80 | +``` |
| 81 | +pip install plotly==4.0.0a4 |
| 82 | +``` |
| 83 | + |
| 84 | +or conda. |
| 85 | +``` |
| 86 | +conda install -c plotly/label/test plotly==4.0.0a4 |
| 87 | +``` |
| 88 | + |
| 89 | +### Jupyter Notebook Support |
| 90 | +For use in the Jupyter Notebook, install the `notebook` and `ipywidgets` |
| 91 | +packages using pip... |
| 92 | + |
| 93 | +``` |
| 94 | +pip install "notebook>=5.3" "ipywidgets>=7.2" |
| 95 | +``` |
| 96 | + |
| 97 | +or conda. |
| 98 | + |
| 99 | +``` |
| 100 | +conda install "notebook>=5.3" "ipywidgets>=7.2" |
| 101 | +``` |
| 102 | + |
| 103 | +### JupyterLab Support (Python 3.5+) |
| 104 | +For use in JupyterLab, install the `jupyterlab` and `ipywidgets` |
| 105 | +packages using pip... |
| 106 | + |
| 107 | +``` |
| 108 | +pip install jupyterlab==0.35 "ipywidgets>=7.2" |
| 109 | +``` |
| 110 | + |
| 111 | +or conda. |
| 112 | + |
| 113 | +``` |
| 114 | +conda install jupyterlab=0.35 "ipywidgets>=7.2" |
| 115 | +``` |
| 116 | + |
| 117 | +Then run the following commands to install the required JupyterLab extensions: |
| 118 | +``` |
| 119 | +# Avoid "JavaScript heap out of memory" errors during extension installation |
| 120 | +# (OS X/Linux) |
| 121 | +export NODE_OPTIONS=--max-old-space-size=4096 |
| 122 | +# (Windows) |
| 123 | +set NODE_OPTIONS=--max-old-space-size=4096 |
| 124 | +
|
| 125 | +# Jupyter widgets extension |
| 126 | +jupyter labextension install @jupyter-widgets/jupyterlab-manager@0.38 --no-build |
| 127 | +
|
| 128 | +# FigureWidget support and jupyterlab renderer support |
| 129 | +jupyter labextension install jupyterlab-plotly@1.0.0-alpha.2 --no-build |
| 130 | +
|
| 131 | +# JupyterLab chart editor support (optional) |
| 132 | +jupyter labextension install jupyterlab-chart-editor@1.1 --no-build |
| 133 | +
|
| 134 | +# Build extensions (must be done to activate extensions since --no-build is used above) |
| 135 | +jupyter lab build |
| 136 | +
|
| 137 | +# Unset NODE_OPTIONS environment variable |
| 138 | +# (OS X/Linux) |
| 139 | +unset NODE_OPTIONS |
| 140 | +# (Windows) |
| 141 | +set NODE_OPTIONS= |
| 142 | +``` |
| 143 | + |
| 144 | +### Static Image Export |
| 145 | +plotly.py supports static image export using the `to_image` and `write_image` |
| 146 | +functions in the `plotly.io` package. This functionality requires the |
| 147 | +installation of the plotly [orca](https://github.com/plotly/orca) command line utility and the |
| 148 | +[`psutil`](https://github.com/giampaolo/psutil) Python package. |
| 149 | + |
| 150 | +These dependencies can both be installed using conda: |
| 151 | +``` |
| 152 | +conda install -c plotly plotly-orca psutil |
| 153 | +``` |
| 154 | + |
| 155 | +Or, `psutil` can be installed using pip... |
| 156 | +``` |
| 157 | +pip install psutil |
| 158 | +``` |
| 159 | + |
| 160 | +and orca can be installed according to the instructions in the [orca README](https://github.com/plotly/orca). |
| 161 | + |
| 162 | +### Extended Geo Support |
| 163 | +Some plotly.py features rely on fairly large geographic shape files. The county |
| 164 | +choropleth figure factory is one such example. These shape files are distributed as a |
| 165 | +separate `plotly-geo` package. This package can be installed using pip... |
| 166 | + |
| 167 | +``` |
| 168 | +pip install plotly-geo==1.0.0a1 |
| 169 | +``` |
| 170 | + |
| 171 | +or conda |
| 172 | +``` |
| 173 | +conda install -c plotly/label/test plotly-geo=1.0.0a1 |
| 174 | +``` |
| 175 | + |
| 176 | +### Chart Studio support |
| 177 | +The `chart-studio` package can be used to upload plotly figures to Plotly's Chart |
| 178 | +Studio Cloud or On-Prem service. This package can be installed using pip... |
| 179 | + |
| 180 | +``` |
| 181 | +pip install chart-studio==1.0.0a4 |
| 182 | +``` |
| 183 | + |
| 184 | +or conda |
| 185 | +``` |
| 186 | +conda install -c plotly/label/test chart-studio=1.0.0a4 |
| 187 | +``` |
| 188 | + |
| 189 | +## Migration |
| 190 | +If you're migrating from plotly.py version 2, please check out the [migration guide](migration-guide.md) |
| 191 | + |
| 192 | +## Copyright and Licenses |
| 193 | +Code and documentation copyright 2019 Plotly, Inc. |
| 194 | + |
| 195 | +Code released under the [MIT license](packages/python/chart-studio/LICENSE.txt). |
| 196 | + |
| 197 | +Docs released under the [Creative Commons license](https://github.com/plotly/documentation/blob/source/LICENSE). |
0 commit comments