diff --git a/doc/apidoc/Makefile b/doc/apidoc/Makefile index c2220effc2f..cf5cb7ebdc9 100644 --- a/doc/apidoc/Makefile +++ b/doc/apidoc/Makefile @@ -3,7 +3,7 @@ # You can set these variables from the command line. SPHINXOPTS = -SPHINXBUILD = python3 -m sphinx +SPHINXBUILD = python -m sphinx SOURCEDIR = . BUILDDIR = _build @@ -22,9 +22,13 @@ help: sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*.py sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*.py sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*/*.py - sphinx-apidoc -o generated ../../packages/python/plotly/plotly ../../packages/python/plotly/plotly/validators ../../packages/python/plotly/plotly/tests ../../packages/python/plotly/plotly/matplotlylib/ ../../packages/python/plotly/plotly/offline ../../packages/python/plotly/plotly/api + cp ../../packages/python/plotly/_plotly_utils/colors/sequential.py ../../packages/python/plotly/_plotly_utils/colors/diverging.py ../../packages/python/plotly/_plotly_utils/colors/qualitative.py ../../packages/python/plotly/_plotly_utils/colors/cyclical.py ../../packages/python/plotly/plotly/colors + cp ../../packages/python/plotly/_plotly_utils/colors/sequential.py ../../packages/python/plotly/_plotly_utils/colors/diverging.py ../../packages/python/plotly/_plotly_utils/colors/qualitative.py ../../packages/python/plotly/_plotly_utils/colors/cyclical.py ../../packages/python/plotly/plotly/express/colors + sphinx-apidoc -M -o generated ../../packages/python/plotly/plotly ../../packages/python/plotly/plotly/validators ../../packages/python/plotly/plotly/tests ../../packages/python/plotly/plotly/matplotlylib/ ../../packages/python/plotly/plotly/offline ../../packages/python/plotly/plotly/api @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) git checkout -- ../../packages/python/plotly/plotly/graph_objs + rm ../../packages/python/plotly/plotly/colors/diverging.py ../../packages/python/plotly/plotly/colors/sequential.py ../../packages/python/plotly/plotly/colors/qualitative.py ../../packages/python/plotly/plotly/colors/cyclical.py + rm ../../packages/python/plotly/plotly/express/colors/diverging.py ../../packages/python/plotly/plotly/express/colors/sequential.py ../../packages/python/plotly/plotly/express/colors/qualitative.py ../../packages/python/plotly/plotly/express/colors/cyclical.py rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html mv _build/html/generated/plotly.graph_objs.html _build/html/generated/plotly.graph_objects.html sed -i 's/graph_objs/graph_objects/g' _build/html/*.html diff --git a/doc/apidoc/index.rst b/doc/apidoc/index.rst index 5776cc94621..e9c83e35fe8 100644 --- a/doc/apidoc/index.rst +++ b/doc/apidoc/index.rst @@ -17,6 +17,8 @@ Submodules * :ref:`Subplots: helper function for layout out multi-plot figures ` * :ref:`Figure Factories: helper methods for building specific complex charts ` * :ref:`I/O: low-level interface for displaying, reading and writing figures ` +* :mod:`plotly.colors`: colorscales and utility functions +* :mod:`plotly.data`: built-in datasets for demonstration, educational and test purposes Full reference list ------------------- diff --git a/doc/apidoc/plotly.express.rst b/doc/apidoc/plotly.express.rst index 191ca9f4a70..c1c56c3c51b 100644 --- a/doc/apidoc/plotly.express.rst +++ b/doc/apidoc/plotly.express.rst @@ -1,7 +1,7 @@ .. _px: `plotly.express`: high-level interface for data visualization -================================ +============================================================= The `plotly.express `_ module is plotly's high-level API for rapid figure generation. :: @@ -49,4 +49,12 @@ plotly's high-level API for rapid figure generation. :: imshow +`plotly.express` subpackages +--------------------------- + +.. toctree:: + :maxdepth: 1 + + generated/plotly.express.data.rst + generated/plotly.express.colors.rst diff --git a/packages/python/plotly/_plotly_utils/colors/cyclical.py b/packages/python/plotly/_plotly_utils/colors/cyclical.py index 1c7315268fa..bab6fdfc4ff 100644 --- a/packages/python/plotly/_plotly_utils/colors/cyclical.py +++ b/packages/python/plotly/_plotly_utils/colors/cyclical.py @@ -185,3 +185,9 @@ def swatches_cyclical(template=None): if _k.startswith("_") or _k.startswith("swatches") or _k.endswith("_r"): continue globals()[_k + "_r"] = _cols[::-1] + + +__all__ = [ + "swatches", + "swatches_cyclical", +] diff --git a/packages/python/plotly/_plotly_utils/colors/diverging.py b/packages/python/plotly/_plotly_utils/colors/diverging.py index 3b4304e74df..2e20a4fd8b5 100644 --- a/packages/python/plotly/_plotly_utils/colors/diverging.py +++ b/packages/python/plotly/_plotly_utils/colors/diverging.py @@ -37,3 +37,6 @@ def swatches(template=None): if _k.startswith("_") or _k == "swatches" or _k.endswith("_r"): continue globals()[_k + "_r"] = _cols[::-1] + + +__all__ = ["swatches"] diff --git a/packages/python/plotly/_plotly_utils/colors/qualitative.py b/packages/python/plotly/_plotly_utils/colors/qualitative.py index fbc4aa6f034..41fe43fc3d6 100644 --- a/packages/python/plotly/_plotly_utils/colors/qualitative.py +++ b/packages/python/plotly/_plotly_utils/colors/qualitative.py @@ -152,3 +152,6 @@ def swatches(template=None): if _k.startswith("_") or _k == "swatches" or _k.endswith("_r"): continue globals()[_k + "_r"] = _cols[::-1] + + +__all__ = ["swatches"] diff --git a/packages/python/plotly/_plotly_utils/colors/sequential.py b/packages/python/plotly/_plotly_utils/colors/sequential.py index f1aaae78215..bc408e47deb 100644 --- a/packages/python/plotly/_plotly_utils/colors/sequential.py +++ b/packages/python/plotly/_plotly_utils/colors/sequential.py @@ -162,3 +162,6 @@ def swatches(template=None): if _k.startswith("_") or _k == "swatches" or _k.endswith("_r"): continue globals()[_k + "_r"] = _cols[::-1] + + +__all__ = ["swatches"] diff --git a/packages/python/plotly/plotly/colors.py b/packages/python/plotly/plotly/colors.py deleted file mode 100644 index 1cd57ec88b1..00000000000 --- a/packages/python/plotly/plotly/colors.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import absolute_import -from _plotly_utils.colors import * # noqa: F401 diff --git a/packages/python/plotly/plotly/colors/__init__.py b/packages/python/plotly/plotly/colors/__init__.py new file mode 100644 index 00000000000..229326634d7 --- /dev/null +++ b/packages/python/plotly/plotly/colors/__init__.py @@ -0,0 +1,24 @@ +"""For a list of colors available in `plotly.colors`, please see + +* the `tutorial on discrete color sequences `_ +* the `list of built-in continuous color scales `_ +* the `tutorial on continuous colors `_ + +Color scales and sequences are available within the following namespaces + +* cyclical +* diverging +* qualitative +* sequential +""" + +from __future__ import absolute_import +from _plotly_utils.colors import * # noqa: F401 + +__all__ = [ + "named_colorscales", + "cyclical", + "diverging", + "sequential", + "qualitative", +] diff --git a/packages/python/plotly/plotly/express/_core.py b/packages/python/plotly/plotly/express/_core.py index 216b16716c9..0520cd2a1f6 100644 --- a/packages/python/plotly/plotly/express/_core.py +++ b/packages/python/plotly/plotly/express/_core.py @@ -4,7 +4,7 @@ from ._special_inputs import IdentityMap, Constant, Range from _plotly_utils.basevalidators import ColorscaleValidator -from .colors import qualitative, sequential +from plotly.colors import qualitative, sequential import math import pandas as pd import numpy as np diff --git a/packages/python/plotly/plotly/express/colors.py b/packages/python/plotly/plotly/express/colors.py deleted file mode 100644 index 134f1707e9a..00000000000 --- a/packages/python/plotly/plotly/express/colors.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import absolute_import -from plotly.colors import * diff --git a/packages/python/plotly/plotly/express/colors/__init__.py b/packages/python/plotly/plotly/express/colors/__init__.py new file mode 100644 index 00000000000..dafbee10e62 --- /dev/null +++ b/packages/python/plotly/plotly/express/colors/__init__.py @@ -0,0 +1,25 @@ +"""For a list of colors available in `plotly.express.colors`, please see + +* the `tutorial on discrete color sequences `_ +* the `list of built-in continuous color scales `_ +* the `tutorial on continuous colors `_ + +Color scales are available within the following namespaces + +* cyclical +* diverging +* qualitative +* sequential +""" + +from __future__ import absolute_import +from plotly.colors import * + + +__all__ = [ + "named_colorscales", + "cyclical", + "diverging", + "sequential", + "qualitative", +] diff --git a/packages/python/plotly/plotly/express/data.py b/packages/python/plotly/plotly/express/data.py deleted file mode 100644 index 375de95c4fd..00000000000 --- a/packages/python/plotly/plotly/express/data.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import absolute_import -from plotly.data import * diff --git a/packages/python/plotly/plotly/express/data/__init__.py b/packages/python/plotly/plotly/express/data/__init__.py new file mode 100644 index 00000000000..f4bc598bcb8 --- /dev/null +++ b/packages/python/plotly/plotly/express/data/__init__.py @@ -0,0 +1,15 @@ +"""Built-in datasets for demonstration, educational and test purposes. +""" + +from __future__ import absolute_import +from plotly.data import * + +__all__ = [ + "carshare", + "election", + "election_geojson", + "gapminder", + "iris", + "tips", + "wind", +] diff --git a/packages/python/plotly/setup.py b/packages/python/plotly/setup.py index ec74283d2d6..33cfff8d49f 100644 --- a/packages/python/plotly/setup.py +++ b/packages/python/plotly/setup.py @@ -479,7 +479,10 @@ def run(self): "plotly.matplotlylib.mplexporter.renderers", "plotly.figure_factory", "plotly.data", + "plotly.colors", "plotly.express", + "plotly.express.data", + "plotly.express.colors", "plotly.graph_objects", "_plotly_utils", "_plotly_utils.colors",