Skip to content

Commit 2658105

Browse files
figure factory pages
1 parent 200d534 commit 2658105

15 files changed

+528
-68
lines changed

doc/apidoc/conf.py

Lines changed: 3 additions & 3 deletions
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 ---------------------------------------------------

doc/python/annotated-heatmap.md

Lines changed: 2 additions & 5 deletions
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)

doc/python/county-choropleth.md

Lines changed: 1 addition & 8 deletions
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
@@ -274,10 +274,3 @@ fig.show()
274274
```
275275

276276
Also see Mapbox county choropleths made in Python: [https://plotly.com/python/mapbox-county-choropleth/](https://plotly.com/python/mapbox-county-choropleth/)
277-
278-
279-
#### Reference
280-
281-
```python
282-
help(ff.create_choropleth)
283-
```

doc/python/creating-and-updating-figures.md

Lines changed: 26 additions & 26 deletions
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,21 +63,21 @@ 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

@@ -93,7 +93,7 @@ As an alternative to working with Python dictionaries, the `plotly.py` graphing
9393

9494
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

@@ -148,11 +148,11 @@ print("\n\nJSON Representation of A Graph Object:\n" + str(fig.to_json()))
148148

149149
### Creating Figures
150150

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

153153
#### Constructor
154154

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.
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.
156156

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

@@ -185,7 +185,7 @@ fig.show()
185185

186186
#### Figure Factories
187187

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.
188+
[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.
189189

190190
```python
191191
import numpy as np
@@ -240,7 +240,7 @@ import plotly.express as px
240240

241241
df = px.data.iris()
242242

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

246246
fig.add_trace(
@@ -276,7 +276,7 @@ import plotly.express as px
276276

277277
df = px.data.iris()
278278

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

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

295295
#### Add Trace Convenience Methods
296296

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.
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.
298298

299299
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()`.
300300

@@ -311,11 +311,11 @@ fig.show()
311311

312312
#### Magic Underscore Notation
313313

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

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

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"))`.
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"))`.
319319

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

@@ -349,7 +349,7 @@ Magic underscore notation is supported throughout the graph objects API, and it
349349
350350
#### Updating Figure Layouts
351351

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

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

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

387387
#### Updating Traces
388388

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.
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.
390390

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

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

538538
df = px.data.iris()
539539

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

543543
fig.update_traces(
@@ -580,7 +580,7 @@ import plotly.express as px
580580

581581
df = px.data.iris()
582582

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

586586
fig.for_each_trace(
@@ -600,7 +600,7 @@ import plotly.express as px
600600

601601
df = px.data.iris()
602602

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

606606
fig.update_xaxes(showgrid=False)
@@ -614,8 +614,8 @@ There are also `for_each_xaxis()` and `for_each_yaxis()` methods that are analog
614614

615615
Figures created with the plotly.py graphing library also support:
616616

617-
- the `update_layout_images()` method in order to [update background layout images](/python/images/),
618-
- `update_annotations()` in order to [update annotations](/python/text-and-annotations/#multiple-annotations),
617+
- the `update_layout_images()` method in order to [update background layout images](/python/images/),
618+
- `update_annotations()` in order to [update annotations](/python/text-and-annotations/#multiple-annotations),
619619
- and `update_shapes()` in order to [update shapes](/python/shapes/).
620620

621621
#### Chaining Figure Operations
@@ -624,10 +624,10 @@ All of the figure update operations described above are methods that return a re
624624

625625
Here is an example of a chained expression that creates:
626626

627-
- a faceted scatter plot with OLS trend lines using Plotly Express,
628-
- sets the title font size using `update_layout()`,
629-
- disables vertical grid lines using `update_xaxes()`,
630-
- updates the width and dash pattern of the trend lines using `update_traces()`,
627+
- a faceted scatter plot with OLS trend lines using Plotly Express,
628+
- sets the title font size using `update_layout()`,
629+
- disables vertical grid lines using `update_xaxes()`,
630+
- updates the width and dash pattern of the trend lines using `update_traces()`,
631631
- and then displays the figure using `show()`.
632632

633633
```python
@@ -636,7 +636,7 @@ import plotly.express as px
636636
df = px.data.iris()
637637

638638
(px.scatter(df, x="sepal_width", y="sepal_length", color="species",
639-
facet_col="species", trendline="ols",
639+
facet_col="species", trendline="ols",
640640
title="Chaining Multiple Figure Operations With A Plotly Express Figure")
641641
.update_layout(title_font_size=24)
642642
.update_xaxes(showgrid=False)

doc/python/dendrogram.md

Lines changed: 2 additions & 4 deletions
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)

doc/python/distplot.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fig.show()
5858

5959
## Combined statistical representations with distplot figure factory
6060

61-
The distplot figure factory displays a combination of statistical representations of numerical data, such as histogram, kernel density estimation or normal curve, and rug plot.
61+
The distplot [figure factory](/python/figure-factories/) displays a combination of statistical representations of numerical data, such as histogram, kernel density estimation or normal curve, and rug plot.
6262

6363
#### Basic Distplot
6464

@@ -286,6 +286,5 @@ fig.show()
286286

287287
#### Reference
288288

289-
```python
290-
help(ff.create_distplot)
291-
```
289+
290+
For more info on `ff.create_distplot()`, see the [full function reference](https://plotly.com/python-api-reference/generated/plotly.figure_factory.create_distplot.html)

doc/python/figure-factories.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
jupyter:
3+
jupytext:
4+
notebook_metadata_filter: all
5+
text_representation:
6+
extension: .md
7+
format_name: markdown
8+
format_version: "1.2"
9+
jupytext_version: 1.3.1
10+
kernelspec:
11+
display_name: Python 3
12+
language: python
13+
name: python3
14+
language_info:
15+
codemirror_mode:
16+
name: ipython
17+
version: 3
18+
file_extension: .py
19+
mimetype: text/x-python
20+
name: python
21+
nbconvert_exporter: python
22+
pygments_lexer: ipython3
23+
version: 3.6.8
24+
plotly:
25+
description:
26+
Figure Factories are dedicated functions for creating very specific types of plots.
27+
display_as: file_settings
28+
language: python
29+
layout: base
30+
name: Figure Factories
31+
order: 32
32+
permalink: python/figure-factories/
33+
thumbnail: thumbnail/streamline.jpg
34+
---
35+
36+
#### `plotly.figure_factory`
37+
38+
The `plotly.figure_factory` module contains dedicated functions for creating very specific types of plots that were at the time of their creation difficult to create with `plotly.graph_objects` and prior to the existence of [Plotly Express](/python/plotly-express/). As new functionality gets added to [Plotly.js](https://plotly.com/javascript/) and to Plotly Express, certain Figure Factories become unecessary and are therefore deprecated as "legacy", but remain in the module for backwards-compatibility reasons.
39+
40+
The following types of plots are still difficult to create with Graph Objects or Plotly Express and therefore the corresponding Figure Factories are *not* deprecated:
41+
42+
* [Annotated Heatmaps](/python/annotated-heatmap/)
43+
* [Dendrograms](/python/dendrogram/)
44+
* [Gantt Charts](/python/gantt/)
45+
* [Quiver Plots](/python/quiver-plots/)
46+
* [Streamline Plots](/python/streamline-plots/)
47+
* [Tables](/python/figure-factory-tables/)
48+
* [Ternary Contour Plots](/python/ternary-contour/)
49+
* [Triangulated Surface Plots](/python/trisurf/)
50+
51+
Deprecated "legacy" Figure Factories include:
52+
53+
* [County Choropleth Maps](/python/county-choropleth/), deprecated by regular [Choropleth maps with GeoJSON input](/python/choropleth-maps/)
54+
* [Distplots](/python/distplot/), mostly deprecated by [`px.histogram`](/python/histograms/)
55+
56+
#### Reference
57+
58+
For more information about the contents of `plotly.figure_factory`, including deprecated methods, please refer to our [API Reference documentation](https://plotly.com/python-api-reference/plotly.figure_factory.html).

doc/python/figure-factory-subplots.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ jupyter:
3434
---
3535

3636
#### Plotly's Figure Factory Module
37-
Plotly's Python API contains a figure factory module which includes many wrapper functions that create unique chart types that are not yet included in [plotly.js](https://github.com/plotly/plotly.js), Plotly's open-source graphing library. The figure factory functions create a full figure, so some Plotly features, such as subplotting, should be implemented slightly differently with these charts.
37+
38+
Plotly's Python API contains a [figure factory module](/python/figure-factories/) which includes many wrapper functions that create unique chart types that are not yet included in [plotly.js](https://github.com/plotly/plotly.js), Plotly's open-source graphing library. The figure factory functions create a full figure, so some Plotly features, such as subplotting, should be implemented slightly differently with these charts.
3839

3940

4041
#### Vertical Figure Factory Charts

0 commit comments

Comments
 (0)