diff --git a/doc/python/plotly-express.md b/doc/python/plotly-express.md index 4a3327c848d..4a95d899589 100644 --- a/doc/python/plotly-express.md +++ b/doc/python/plotly-express.md @@ -38,6 +38,8 @@ jupyter: The `plotly.express` module (usually imported as `px`) contains functions that can create entire figures at once, and is referred to as Plotly Express or PX. Plotly Express is a built-in part of the `plotly` library, and is the recommended starting point for creating most common figures. Every Plotly Express function uses [graph objects](/python/graph-objects/) internally and returns a `plotly.graph_objects.Figure` instance. Throughout the `plotly` documentation, you will find the Plotly Express way of building figures at the top of any applicable page, followed by a section on how to use graph objects to build similar figures. Any figure created in a single function call with Plotly Express could be created using graph objects alone, but with between 5 and 100 times more code. +Unlike Plotly itself, Plotly Express requires Pandas to be installed. If desired this dependency can be made explicit by installing/depending on `plotly[express]`. + Plotly Express provides [more than 30 functions for creating different types of figures](https://plotly.com/python-api-reference/plotly.express.html). The API for these functions was carefully designed to be as consistent and easy to learn as possible, making it easy to switch from a scatter plot to a bar chart to a histogram to a sunburst chart throughout a data exploration session. *Scroll down for a gallery of Plotly Express plots, each made in a single function call.* Here is a talk from the [SciPy 2021 conference](https://www.scipy2021.scipy.org/) that gives a good introduction to Plotly Express and [Dash](https://dash.plotly.com/): diff --git a/packages/python/plotly/plotly/express/__init__.py b/packages/python/plotly/plotly/express/__init__.py index c8fab13b5f8..bd8fb5f3163 100644 --- a/packages/python/plotly/plotly/express/__init__.py +++ b/packages/python/plotly/plotly/express/__init__.py @@ -9,7 +9,8 @@ if pd is None: raise ImportError( """\ -Plotly express requires pandas to be installed.""" +Plotly express requires pandas to be installed. Install plotly[express] to create a dependency on pandas. +""" ) from ._imshow import imshow diff --git a/packages/python/plotly/setup.py b/packages/python/plotly/setup.py index 7567cf81569..1fc6abf1754 100644 --- a/packages/python/plotly/setup.py +++ b/packages/python/plotly/setup.py @@ -554,6 +554,9 @@ def run(self): ("etc/jupyter/nbconfig/notebook.d", ["jupyterlab-plotly.json"]), ], install_requires=["tenacity>=6.2.0"], + extras_require={ + "express": ["pandas>=1.5.0"], + }, zip_safe=False, cmdclass=dict( build_py=js_prerelease(versioneer_cmds["build_py"]),