Skip to content

Commit 0e77150

Browse files
Merge branch 'doc-prod'
2 parents 0c4d8dd + a8a952d commit 0e77150

21 files changed

+560
-330
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ For use in JupyterLab, install the `jupyterlab` and `ipywidgets`
112112
packages using pip...
113113

114114
```
115-
pip install jupyterlab "ipywidgets=7.5"
115+
pip install jupyterlab "ipywidgets==7.5"
116116
```
117117

118118
or conda.

Diff for: doc/apidoc/conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
# -- Project information -----------------------------------------------------
2323

2424
project = ""
25-
copyright = "2019, plotly team"
26-
author = "plotly team"
25+
copyright = "2020, Plotly"
26+
author = "Plotly"
2727

2828
# The short X.Y version
2929
version = ""
3030
# The full version, including alpha/beta/rc tags
31-
release = "4.7.0"
31+
release = "4.7.1"
3232

3333

3434
# -- General configuration ---------------------------------------------------

Diff for: doc/apidoc/plotly.figure_factory.rst

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
create_annotated_heatmap
1414
create_bullet
1515
create_candlestick
16+
create_choropleth
1617
create_dendrogram
1718
create_distplot
1819
create_facet_grid

Diff for: doc/apidoc/plotly.graph_objects.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Figure
1818
:toctree: generated/
1919
:template: class_figure.rst
2020

21-
Figure
21+
Figure
2222

2323

2424
Layout
@@ -31,7 +31,7 @@ Layout
3131
Layout
3232

3333

34-
Simple charts
34+
Simple Traces
3535
--------------
3636

3737
.. autosummary::
@@ -47,7 +47,7 @@ Simple charts
4747
Contour
4848
Table
4949

50-
Distributions
50+
Distribution Traces
5151
-------------
5252

5353
.. autosummary::
@@ -60,7 +60,7 @@ Distributions
6060
Histogram2d
6161
Histogram2dContour
6262

63-
Finance
63+
Finance Traces
6464
-------
6565

6666
.. autosummary::
@@ -74,7 +74,7 @@ Finance
7474
Funnelarea
7575
Indicator
7676

77-
3D
77+
3D Traces
7878
--
7979

8080
.. autosummary::
@@ -89,7 +89,7 @@ Finance
8989
Volume
9090
Isosurface
9191

92-
Maps
92+
Map Traces
9393
----
9494

9595
.. autosummary::
@@ -102,7 +102,7 @@ Maps
102102
Choroplethmapbox
103103
Densitymapbox
104104

105-
Specialized
105+
Specialized Traces
106106
-----------
107107

108108
.. autosummary::

Diff for: doc/python/annotated-heatmap.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jupyter:
3636

3737
#### Simple Annotated Heatmap
3838

39-
For more examples with Heatmaps, see [this page](/python/heatmaps/).
39+
This page details the use of a [figure factory](/python/figure-factories/). For more examples with Heatmaps, see [this page](/python/heatmaps/).
4040

4141
```python
4242
import plotly.figure_factory as ff
@@ -202,8 +202,5 @@ fig.show()
202202
```
203203

204204
#### Reference
205-
For more info on Plotly heatmaps, see: https://plotly.com/python/reference/#heatmap.<br> For more info on using colorscales with Plotly see: https://plotly.com/python/heatmap-and-contour-colorscales/ <br>For more info on annotated_heatmaps, see:
206205

207-
```python
208-
help(ff.create_annotated_heatmap)
209-
```
206+
For more info on Plotly heatmaps, see: https://plotly.com/python/reference/#heatmap.<br> For more info on using colorscales with Plotly see: https://plotly.com/python/heatmap-and-contour-colorscales/ <br>For more info on `ff.create_annotated_heatmap()`, see the [full function reference](https://plotly.com/python-api-reference/generated/plotly.figure_factory.create_annotated_heatmap.html#plotly.figure_factory.create_annotated_heatmap)

Diff for: doc/python/county-choropleth.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jupyter:
3737
### Deprecation warning
3838

3939

40-
This page describes a legacy "figure factory" method for creating map-like figures using [self-filled scatter traces](/python/shapes). **This is no longer the recommended way to make county-level choropleth maps**, instead we recommend using a [GeoJSON-based approach to making outline choropleth maps](/python/choropleth-maps/) or the alternative [Mapbox tile-based choropleth maps](/python/mapbox-county-choropleth).
40+
This page describes a [legacy "figure factory" method](/python/figure-factories/) for creating map-like figures using [self-filled scatter traces](/python/shapes). **This is no longer the recommended way to make county-level choropleth maps**, instead we recommend using a [GeoJSON-based approach to making outline choropleth maps](/python/choropleth-maps/) or the alternative [Mapbox tile-based choropleth maps](/python/mapbox-county-choropleth).
4141

4242

4343
#### Required Packages
@@ -275,9 +275,6 @@ fig.show()
275275

276276
Also see Mapbox county choropleths made in Python: [https://plotly.com/python/mapbox-county-choropleth/](https://plotly.com/python/mapbox-county-choropleth/)
277277

278+
### Reference
278279

279-
#### Reference
280-
281-
```python
282-
help(ff.create_choropleth)
283-
```
280+
For more info on `ff.create_choropleth()`, see the [full function reference](https://plotly.com/python-api-reference/generated/plotly.figure_factory.create_choropleth.html)

Diff for: doc/python/creating-and-updating-figures.md

+41-38
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ jupyter:
3939

4040
### Representing Figures
4141

42-
The goal of the plotly.py package is to provide a pleasant Python interface for creating figure specifications which are displayed by the [plotly.js](https://plot.ly/javascript) JavaScript graphing library.
42+
The goal of the plotly.py package is to provide a pleasant Python interface for creating figure specifications which are displayed by the [plotly.js](https://plot.ly/javascript) JavaScript graphing library.
4343

44-
In the context of the plotly.js library, a figure is specified by a declarative [JSON](https://www.json.org/json-en.html) data structure.
44+
In the context of the plotly.js library, a figure is specified by a declarative [JSON](https://www.json.org/json-en.html) data structure.
4545

4646
Therefore, you should always keep in mind as you are creating and updating figures using the plotly.py package that its ultimate goal is to help users produce Python [dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) that can be automatically [serialized](https://en.wikipedia.org/wiki/Serialization) into the JSON data structure that the plotly.js graphing library understands.
4747

@@ -63,37 +63,37 @@ import plotly.io as pio
6363
pio.show(fig)
6464
```
6565

66-
Let's take a closer look at structure of the `fig` dictionary in order to better understand how `plotly.py` figures are built.
66+
Let's take a closer look at structure of the `fig` dictionary in order to better understand how `plotly.py` figures are built.
6767

6868
##### The `"data"` Key
6969

7070
The `"data"` key stores the value of list which describes the trace or traces which make up a figure. It is still a list even if the figure only contains one trace, as in the example above.
7171

7272
Each trace in the list stored by the `"data"` key is itself defined by a dictionary. The type of the trace (`"bar"`, `"scatter"`, `"contour"`, etc...) is specified with a `"type"` key, and the rest of the keys in a trace specification dictionary (`x`, `y`, etc...) are used to define the properties specific to the trace of that type.
7373

74-
##### The `"layout"` Key
74+
##### The `"layout"` Key
7575

7676
The`"layout"` key stores a dictionary that specifies properties related to customizing how the figure looks, such as its title, typography, margins, axes, annotations, shapes, legend and more. In contrast to trace configuration options, which apply only to individual traces, layout configuration options apply to the figure as a whole.
7777

7878
The [_Full Reference_](https://plot.ly/python/reference/) page contains descriptions of all of the supported trace and layout attributes and configuration options.
7979

80-
If working from the _Full Reference_ to build figures as Python dictionaries and lists suites your needs, go for it!
80+
If working from the _Full Reference_ to build figures as Python dictionaries and lists suites your needs, go for it!
8181

8282
This is a perfectly valid way to use `plotly.py` to build figures. On the other hand, if you would like to use an API that offers you a bit more assistance in the figure creation process, read on to learn about `graph objects`.
8383

8484
#### Figures as Graph Objects
8585

8686
As an alternative to working with Python dictionaries, the `plotly.py` graphing library provides a hierarchy of classes called "graph objects" that may be used to construct figures. Graph objects have several benefits compared to plain Python dictionaries.
8787

88-
1. Graph objects provide precise data validation. If you provide an invalid property name or an invalid property value as the key to a graph object, an exception will be raised with a helpful error message describing the problem. This is not the case if you use plain Python dictionaries and lists to build your figures.
88+
1. Graph objects provide precise data validation. If you provide an invalid property name or an invalid property value as the key to a graph object, an exception will be raised with a helpful error message describing the problem. This is not the case if you use plain Python dictionaries and lists to build your figures.
8989

90-
2. Graph objects contain descriptions of each valid property as Python `docstrings`. You can use these `docstrings` in the development environment of your choice to learn about the available properties as an alternative to consulting the online _Full Reference_.
90+
2. Graph objects contain descriptions of each valid property as Python `docstrings`. You can use these `docstrings` in the development environment of your choice to learn about the available properties as an alternative to consulting the online [Full Reference](/python/reference/).
9191

92-
3. Properties of graph objects can be accessed using both dictionary-style key lookup (e.g. `fig["layout"]`) or class-style property access (e.g. `fig.layout`).
92+
3. Properties of graph objects can be accessed using both dictionary-style key lookup (e.g. `fig["layout"]`) or class-style property access (e.g. `fig.layout`).
9393

94-
4. Graph objects support higher-level convenience functions for making updates to already constructed figures, as described below.
94+
4. Graph objects support higher-level convenience functions for making updates to already constructed figures, as described below.
9595

96-
**Graph objects are stored in a hierarchy of modules under the `plotly.graph_objects` package, so make sure to remember to `import plotly.graph_objects as go` when you want to use them.**
96+
**Graph objects are stored in a hierarchy of modules under the `plotly.graph_objects` package, so make sure to remember to `import plotly.graph_objects as go` when you want to use them.**
9797

9898
Below you can find an example of one way that the figure in the example above could be specified using a graph object instead of a dictionary.
9999

@@ -136,23 +136,24 @@ import plotly.graph_objects as go
136136

137137
fig = go.Figure(
138138
data=[go.Bar(x=[1, 2, 3], y=[1, 3, 2])],
139-
layout=go.Layout(
140-
title=go.layout.Title(text="Converting Graph Objects To Dictionaries and JSON")
141-
)
139+
layout=go.Layout(height=600, width=800)
142140
)
143141

144-
print("Dictionary Representation of A Graph Object:\n" + str(fig.to_dict()))
142+
fig.layout.template = None # to slim down the output
145143

146-
print("\n\nJSON Representation of A Graph Object:\n" + str(fig.to_json()))
144+
print("Dictionary Representation of A Graph Object:\n\n" + str(fig.to_dict()))
145+
print("\n\n")
146+
print("JSON Representation of A Graph Object:\n\n" + str(fig.to_json()))
147+
print("\n\n")
147148
```
148149

149150
### Creating Figures
150151

151-
This section summarizes several ways to create new graph object figures with the `plotly.py` graphing library.
152+
This section summarizes several ways to create new graph object figures with the `plotly.py` graphing library.
152153

153-
#### Constructor
154+
#### Graph Objects `Figure` Constructor
154155

155-
As demonstrated above, you can build a complete figure by passing trace and layout specifications to the `plotly.graph_objects.Figure` constructor. These trace and layout specifications can be either dictionaries or graph objects.
156+
As demonstrated above, you can build a complete figure by passing trace and layout specifications to the `plotly.graph_objects.Figure` constructor. These trace and layout specifications can be either dictionaries or graph objects.
156157

157158
In the following example, the traces are specified using graph objects and the layout is specified as a dictionary.
158159

@@ -185,7 +186,7 @@ fig.show()
185186

186187
#### Figure Factories
187188

188-
Figure factories (included in `plotly.py` in the `plotly.figure_factory` module) are functions that produce graph object figures, often to satisfy the needs of specialized domains. Here's an example of using the `create_quiver()` figure factory to construct a graph object figure that displays a 2D quiver plot.
189+
[Figure factories](/python/figure-factories) (included in `plotly.py` in the `plotly.figure_factory` module) are functions that produce graph object figures, often to satisfy the needs of specialized domains. Here's an example of using the `create_quiver()` figure factory to construct a graph object figure that displays a 2D quiver plot.
189190

190191
```python
191192
import numpy as np
@@ -240,7 +241,7 @@ import plotly.express as px
240241

241242
df = px.data.iris()
242243

243-
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
244+
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
244245
title="Using The add_trace() method With A Plotly Express Figure")
245246

246247
fig.add_trace(
@@ -276,7 +277,7 @@ import plotly.express as px
276277

277278
df = px.data.iris()
278279

279-
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species", facet_col="species",
280+
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species", facet_col="species",
280281
title="Adding Traces To Subplots Witin A Plotly Express Figure")
281282

282283
reference_line = go.Scatter(x=[2, 4],
@@ -294,7 +295,7 @@ fig.show()
294295

295296
#### Add Trace Convenience Methods
296297

297-
As an alternative to the `add_trace()` method, graph object figures have a family of methods of the form `add_{trace}` (where `{trace}` is the name of a trace type) for constructing and adding traces of each trace type.
298+
As an alternative to the `add_trace()` method, graph object figures have a family of methods of the form `add_{trace}` (where `{trace}` is the name of a trace type) for constructing and adding traces of each trace type.
298299

299300
Here is the previous subplot example, adapted to add the scatter trace using `fig.add_scatter()` and to add the bar trace using `fig.add_bar()`.
300301

@@ -311,11 +312,11 @@ fig.show()
311312

312313
#### Magic Underscore Notation
313314

314-
To make it easier to work with nested properties, graph object constructors and many graph object methods support magic underscore notation.
315+
To make it easier to work with nested properties, graph object constructors and many graph object methods support magic underscore notation.
315316

316317
This allows you to reference nested properties by joining together multiple nested property names with underscores.
317318

318-
For example, specifying the figure title in the figure constructor _without_ magic underscore notation requires setting the `layout` argument to `dict(title=dict(text="A Chart"))`.
319+
For example, specifying the figure title in the figure constructor _without_ magic underscore notation requires setting the `layout` argument to `dict(title=dict(text="A Chart"))`.
319320

320321
Similarly, setting the line color of a scatter trace requires setting the `marker` property to `dict(color="crimson")`.
321322

@@ -349,7 +350,7 @@ Magic underscore notation is supported throughout the graph objects API, and it
349350
350351
#### Updating Figure Layouts
351352

352-
Graph object figures support an `update_layout()` method that may be used to update multiple nested properties of a figure's layout.
353+
Graph object figures support an `update_layout()` method that may be used to update multiple nested properties of a figure's layout.
353354

354355
Here is an example of updating the text and font size of a figure's title using `update_layout()`.
355356

@@ -386,7 +387,7 @@ fig.update_layout(title=go.layout.Title(text="update_layout() Syntax Example",
386387

387388
#### Updating Traces
388389

389-
Graph object figures support an `update_traces()` method that may be used to update multiple nested properties of one or more of a figure's traces.
390+
Graph object figures support an `update_traces()` method that may be used to update multiple nested properties of one or more of a figure's traces.
390391

391392
To show some examples, we will start with a figure that contains `bar` and `scatter` traces across two subplots.
392393

@@ -537,7 +538,7 @@ import plotly.express as px
537538

538539
df = px.data.iris()
539540

540-
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
541+
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
541542
facet_col="species", trendline="ols", title="Using update_traces() With Plotly Express Figures")
542543

543544
fig.update_traces(
@@ -580,7 +581,7 @@ import plotly.express as px
580581

581582
df = px.data.iris()
582583

583-
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
584+
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
584585
title="Conditionally Updating Traces In A Plotly Express Figure With for_each_trace()")
585586

586587
fig.for_each_trace(
@@ -600,7 +601,7 @@ import plotly.express as px
600601

601602
df = px.data.iris()
602603

603-
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
604+
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
604605
facet_col="species", title="Using update_xaxes() With A Plotly Express Figure")
605606

606607
fig.update_xaxes(showgrid=False)
@@ -613,28 +614,30 @@ There are also `for_each_xaxis()` and `for_each_yaxis()` methods that are analog
613614
### Other Update Methods
614615

615616
Figures created with the plotly.py graphing library also support:
616-
- the `update_layout_images()` method in order to [update background layout images](/python/images/),
617-
- `update_annotations()` in order to [update annotations](/python/text-and-annotations/#multiple-annotations),
618-
- and `update-shapes()` in order to [update shapes](/python/shapes/).
617+
618+
- the `update_layout_images()` method in order to [update background layout images](/python/images/),
619+
- `update_annotations()` in order to [update annotations](/python/text-and-annotations/#multiple-annotations),
620+
- and `update_shapes()` in order to [update shapes](/python/shapes/).
619621

620622
#### Chaining Figure Operations
621623

622624
All of the figure update operations described above are methods that return a reference to the figure being modified. This makes it possible the chain multiple figure modification operations together into a single expression.
623625

624626
Here is an example of a chained expression that creates:
625-
- a faceted scatter plot with OLS trend lines using Plotly Express,
626-
- sets the title font size using `update_layout()`,
627-
- disables vertical grid lines using `update_xaxes()`,
628-
- updates the width and dash pattern of the trend lines using `update_traces()`,
629-
- and then displays the figure using `show()`.
627+
628+
- a faceted scatter plot with OLS trend lines using Plotly Express,
629+
- sets the title font size using `update_layout()`,
630+
- disables vertical grid lines using `update_xaxes()`,
631+
- updates the width and dash pattern of the trend lines using `update_traces()`,
632+
- and then displays the figure using `show()`.
630633

631634
```python
632635
import plotly.express as px
633636

634637
df = px.data.iris()
635638

636639
(px.scatter(df, x="sepal_width", y="sepal_length", color="species",
637-
facet_col="species", trendline="ols",
640+
facet_col="species", trendline="ols",
638641
title="Chaining Multiple Figure Operations With A Plotly Express Figure")
639642
.update_layout(title_font_size=24)
640643
.update_xaxes(showgrid=False)

Diff for: doc/python/dendrogram.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jupyter:
3535

3636
#### Basic Dendrogram
3737

38-
A [dendrogram](https://en.wikipedia.org/wiki/Dendrogram) is a diagram representing a tree. The figure factory `create_dendrogram` performs [hierachical clustering](https://en.wikipedia.org/wiki/Hierarchical_clustering) on data and represents the resulting tree. Values on the tree depth axis correspond to distances between clusters.
38+
A [dendrogram](https://en.wikipedia.org/wiki/Dendrogram) is a diagram representing a tree. The [figure factory](/python/figure-factories/) called `create_dendrogram` performs [hierachical clustering](https://en.wikipedia.org/wiki/Hierarchical_clustering) on data and represents the resulting tree. Values on the tree depth axis correspond to distances between clusters.
3939

4040
Dendrogram plots are commonly used in computational biology to show the clustering of genes or samples, sometimes in the margin of heatmaps.
4141

@@ -178,6 +178,4 @@ fig.show()
178178

179179
### Reference
180180

181-
```python
182-
help(ff.create_dendrogram)
183-
```
181+
For more info on `ff.create_dendrogram()`, see the [full function reference](https://plotly.com/python-api-reference/generated/plotly.figure_factory.create_dendrogram.html)

0 commit comments

Comments
 (0)