Skip to content

Commit 4946db6

Browse files
added links to px.data and px.colors in API doc (#2493)
* added links to px.data and px.colors in API doc * black * removed colors.py as colors has been moved from module to package * try to solve import problem * data subpackage in plotly express * black * requirements: incompatible versions of xarray and pandas * fix import problem * Update doc/apidoc/plotly.express.rst * color namespaces * more doc on colors * Update packages/python/plotly/plotly/colors/__init__.py Co-authored-by: Nicolas Kruchten <[email protected]> * Nic's comments Co-authored-by: Nicolas Kruchten <[email protected]>
1 parent b8da283 commit 4946db6

File tree

15 files changed

+100
-10
lines changed

15 files changed

+100
-10
lines changed

doc/apidoc/Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# You can set these variables from the command line.
55
SPHINXOPTS =
6-
SPHINXBUILD = python3 -m sphinx
6+
SPHINXBUILD = python -m sphinx
77
SOURCEDIR = .
88
BUILDDIR = _build
99

@@ -22,9 +22,13 @@ help:
2222
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*.py
2323
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*.py
2424
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*/*.py
25-
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
25+
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
26+
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
27+
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
2628
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2729
git checkout -- ../../packages/python/plotly/plotly/graph_objs
30+
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
31+
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
2832
rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html
2933
mv _build/html/generated/plotly.graph_objs.html _build/html/generated/plotly.graph_objects.html
3034
sed -i 's/graph_objs/graph_objects/g' _build/html/*.html

doc/apidoc/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Submodules
1717
* :ref:`Subplots: helper function for layout out multi-plot figures <subplots>`
1818
* :ref:`Figure Factories: helper methods for building specific complex charts <ff>`
1919
* :ref:`I/O: low-level interface for displaying, reading and writing figures <io>`
20+
* :mod:`plotly.colors`: colorscales and utility functions
21+
* :mod:`plotly.data`: built-in datasets for demonstration, educational and test purposes
2022

2123
Full reference list
2224
-------------------

doc/apidoc/plotly.express.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _px:
22

33
`plotly.express`: high-level interface for data visualization
4-
================================
4+
=============================================================
55

66
The `plotly.express <https://plot.ly/python/plotly-express/>`_ module is
77
plotly's high-level API for rapid figure generation. ::
@@ -49,4 +49,12 @@ plotly's high-level API for rapid figure generation. ::
4949
imshow
5050

5151

52+
`plotly.express` subpackages
53+
---------------------------
5254

55+
56+
.. toctree::
57+
:maxdepth: 1
58+
59+
generated/plotly.express.data.rst
60+
generated/plotly.express.colors.rst

packages/python/plotly/_plotly_utils/colors/cyclical.py

+6
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,9 @@ def swatches_cyclical(template=None):
185185
if _k.startswith("_") or _k.startswith("swatches") or _k.endswith("_r"):
186186
continue
187187
globals()[_k + "_r"] = _cols[::-1]
188+
189+
190+
__all__ = [
191+
"swatches",
192+
"swatches_cyclical",
193+
]

packages/python/plotly/_plotly_utils/colors/diverging.py

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ def swatches(template=None):
3737
if _k.startswith("_") or _k == "swatches" or _k.endswith("_r"):
3838
continue
3939
globals()[_k + "_r"] = _cols[::-1]
40+
41+
42+
__all__ = ["swatches"]

packages/python/plotly/_plotly_utils/colors/qualitative.py

+3
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,6 @@ def swatches(template=None):
152152
if _k.startswith("_") or _k == "swatches" or _k.endswith("_r"):
153153
continue
154154
globals()[_k + "_r"] = _cols[::-1]
155+
156+
157+
__all__ = ["swatches"]

packages/python/plotly/_plotly_utils/colors/sequential.py

+3
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,6 @@ def swatches(template=None):
162162
if _k.startswith("_") or _k == "swatches" or _k.endswith("_r"):
163163
continue
164164
globals()[_k + "_r"] = _cols[::-1]
165+
166+
167+
__all__ = ["swatches"]

packages/python/plotly/plotly/colors.py

-2
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""For a list of colors available in `plotly.colors`, please see
2+
3+
* the `tutorial on discrete color sequences <https://plotly.com/python/discrete-color/#color-sequences-in-plotly-express>`_
4+
* the `list of built-in continuous color scales <https://plotly.com/python/builtin-colorscales/>`_
5+
* the `tutorial on continuous colors <https://plotly.com/python/colorscales/>`_
6+
7+
Color scales and sequences are available within the following namespaces
8+
9+
* cyclical
10+
* diverging
11+
* qualitative
12+
* sequential
13+
"""
14+
15+
from __future__ import absolute_import
16+
from _plotly_utils.colors import * # noqa: F401
17+
18+
__all__ = [
19+
"named_colorscales",
20+
"cyclical",
21+
"diverging",
22+
"sequential",
23+
"qualitative",
24+
]

packages/python/plotly/plotly/express/_core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from ._special_inputs import IdentityMap, Constant, Range
55

66
from _plotly_utils.basevalidators import ColorscaleValidator
7-
from .colors import qualitative, sequential
7+
from plotly.colors import qualitative, sequential
88
import math
99
import pandas as pd
1010
import numpy as np

packages/python/plotly/plotly/express/colors.py

-2
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""For a list of colors available in `plotly.express.colors`, please see
2+
3+
* the `tutorial on discrete color sequences <https://plotly.com/python/discrete-color/#color-sequences-in-plotly-express>`_
4+
* the `list of built-in continuous color scales <https://plotly.com/python/builtin-colorscales/>`_
5+
* the `tutorial on continuous colors <https://plotly.com/python/colorscales/>`_
6+
7+
Color scales are available within the following namespaces
8+
9+
* cyclical
10+
* diverging
11+
* qualitative
12+
* sequential
13+
"""
14+
15+
from __future__ import absolute_import
16+
from plotly.colors import *
17+
18+
19+
__all__ = [
20+
"named_colorscales",
21+
"cyclical",
22+
"diverging",
23+
"sequential",
24+
"qualitative",
25+
]

packages/python/plotly/plotly/express/data.py

-2
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""Built-in datasets for demonstration, educational and test purposes.
2+
"""
3+
4+
from __future__ import absolute_import
5+
from plotly.data import *
6+
7+
__all__ = [
8+
"carshare",
9+
"election",
10+
"election_geojson",
11+
"gapminder",
12+
"iris",
13+
"tips",
14+
"wind",
15+
]

packages/python/plotly/setup.py

+3
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,10 @@ def run(self):
479479
"plotly.matplotlylib.mplexporter.renderers",
480480
"plotly.figure_factory",
481481
"plotly.data",
482+
"plotly.colors",
482483
"plotly.express",
484+
"plotly.express.data",
485+
"plotly.express.colors",
483486
"plotly.graph_objects",
484487
"_plotly_utils",
485488
"_plotly_utils.colors",

0 commit comments

Comments
 (0)