Skip to content

Commit 793d4ab

Browse files
Merge pull request #2020 from plotly/doc-prod
Merge doc-prod into master
2 parents 90f2370 + bf7426c commit 793d4ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+702
-512
lines changed

Diff for: doc/python/3d-bubble-charts.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
8+
format_version: "1.1"
99
jupytext_version: 1.2.3
1010
kernelspec:
1111
display_name: Python 3
@@ -22,7 +22,8 @@ jupyter:
2222
pygments_lexer: ipython3
2323
version: 3.7.3
2424
plotly:
25-
description: How to make 3D Bubble Charts in Python with Plotly. Three examples
25+
description:
26+
How to make 3D Bubble Charts in Python with Plotly. Three examples
2627
of 3D Bubble Charts.
2728
display_as: 3d_charts
2829
language: python
@@ -39,15 +40,13 @@ jupyter:
3940
```python
4041
import plotly.express as px
4142
import numpy as np
42-
gapminder = px.data.gapminder()
43-
#gapminder.columns
44-
fig = px.scatter_3d(gapminder, x='year', y='continent', z='pop', size='gdpPercap', color='lifeExp',
43+
df = px.data.gapminder()
44+
fig = px.scatter_3d(df, x='year', y='continent', z='pop', size='gdpPercap', color='lifeExp',
4545
hover_data=['country'])
4646
fig.update_layout(scene_zaxis_type="log")
4747
fig.show()
4848
```
4949

50-
5150
#### Simple Bubble Chart
5251

5352
```python
@@ -85,6 +84,7 @@ fig.show()
8584
```
8685

8786
#### Bubble Chart Sized by a Variable
87+
8888
Plot planets' distance from sun, density, and gravity with bubble size based on planet size
8989

9090
```python
@@ -125,6 +125,7 @@ fig.show()
125125
```
126126

127127
#### Edit the Colorbar
128+
128129
Plot planets' distance from sun, density, and gravity with bubble size based on planet size
129130

130131
```python
@@ -165,5 +166,5 @@ fig.show()
165166
```
166167

167168
#### Reference
168-
See https://plot.ly/python/reference/#scatter3d and https://plot.ly/python/reference/#scatter-marker-sizeref <br>for more information and chart attribute options!
169169

170+
See https://plot.ly/python/reference/#scatter3d and https://plot.ly/python/reference/#scatter-marker-sizeref <br>for more information and chart attribute options!

Diff for: doc/python/3d-line-plots.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
8+
format_version: "1.1"
99
jupytext_version: 1.2.3
1010
kernelspec:
1111
display_name: Python 3
@@ -38,20 +38,19 @@ jupyter:
3838
```python
3939
import plotly.express as px
4040
import plotly.express as px
41-
gapminder = px.data.gapminder().query("country=='Brazil'")
42-
fig = px.line_3d(gapminder, x="gdpPercap", y="pop", z="year")
41+
df = px.data.gapminder().query("country=='Brazil'")
42+
fig = px.line_3d(df, x="gdpPercap", y="pop", z="year")
4343
fig.show()
4444
```
4545

4646
```python
4747
import plotly.express as px
4848
import plotly.express as px
49-
gapminder = px.data.gapminder().query("continent=='Europe'")
50-
fig = px.line_3d(gapminder, x="gdpPercap", y="pop", z="year", color='country')
49+
df = px.data.gapminder().query("continent=='Europe'")
50+
fig = px.line_3d(df, x="gdpPercap", y="pop", z="year", color='country')
5151
fig.show()
5252
```
5353

54-
5554
#### 3D Line Plot of Brownian Motion
5655

5756
Here we represent a trajectory in 3D.
@@ -120,5 +119,5 @@ fig.show()
120119
```
121120

122121
#### Reference
123-
See https://plot.ly/python/reference/#scatter3d-marker-line for more information and chart attribute options!
124122

123+
See https://plot.ly/python/reference/#scatter3d-marker-line for more information and chart attribute options!

Diff for: doc/python/3d-scatter-plots.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
8+
format_version: "1.1"
99
jupytext_version: 1.1.1
1010
kernelspec:
1111
display_name: Python 3
@@ -41,8 +41,8 @@ Like the [2D scatter plot](https://plot.ly/python/line-and-scatter/) `px.scatter
4141

4242
```python
4343
import plotly.express as px
44-
iris = px.data.iris()
45-
fig = px.scatter_3d(iris, x='sepal_length', y='sepal_width', z='petal_width',
44+
df = px.data.iris()
45+
fig = px.scatter_3d(df, x='sepal_length', y='sepal_width', z='petal_width',
4646
color='species')
4747
fig.show()
4848
```
@@ -51,8 +51,8 @@ A 4th dimension of the data can be represented thanks to the color of the marker
5151

5252
```python
5353
import plotly.express as px
54-
iris = px.data.iris()
55-
fig = px.scatter_3d(iris, x='sepal_length', y='sepal_width', z='petal_width',
54+
df = px.data.iris()
55+
fig = px.scatter_3d(df, x='sepal_length', y='sepal_width', z='petal_width',
5656
color='petal_length', symbol='species')
5757
fig.show()
5858
```
@@ -63,8 +63,8 @@ It is possible to customize the style of the figure through the parameters of `p
6363

6464
```python
6565
import plotly.express as px
66-
iris = px.data.iris()
67-
fig = px.scatter_3d(iris, x='sepal_length', y='sepal_width', z='petal_width',
66+
df = px.data.iris()
67+
fig = px.scatter_3d(df, x='sepal_length', y='sepal_width', z='petal_width',
6868
color='petal_length', size='petal_length', size_max=18,
6969
symbol='species', opacity=0.7)
7070

@@ -122,7 +122,6 @@ fig.show()
122122

123123
### Dash App
124124

125-
126125
[Dash](https://plot.ly/products/dash/) is an Open Source Python library which can help you convert plotly figures into a reactive, web-based application. Below is a simple example of a dashboard created using Dash. Its [source code](https://github.com/plotly/simple-example-chart-apps/tree/master/dash-3dscatterplot) can easily be deployed to a PaaS.
127126

128127
```python
@@ -136,4 +135,5 @@ IFrame(src= "https://dash-simple-apps.plotly.host/dash-3dscatterplot/code", widt
136135
```
137136

138137
#### Reference
138+
139139
See https://plot.ly/python/reference/#scatter3d for more information and chart attribute options!

Diff for: doc/python/animations.md

+17-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
8+
format_version: "1.1"
99
jupytext_version: 1.1.6
1010
kernelspec:
1111
display_name: Python 3
@@ -24,28 +24,29 @@ jupyter:
2424
---
2525

2626
#### Animated figures with Plotly Express
27+
2728
Several Plotly Express functions support the creation of animated figures through the `animation_frame` and `animation_group` arguments.
2829

2930
Here is an example of an animated scatter plot creating using Plotly Express. Note that you should always fix the `x_range` and `y_range` to ensure that your data remains visible throughout the animation.
3031

3132
```python
3233
import plotly.express as px
33-
gapminder = px.data.gapminder()
34-
px.scatter(gapminder, x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country",
34+
df = px.data.gapminder()
35+
px.scatter(df, x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country",
3536
size="pop", color="continent", hover_name="country",
3637
log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])
3738
```
3839

3940
#### Animated Bar Charts with Plotly Express
4041

41-
Note that you should always fix the `y_range` to ensure that your data remains visible throughout the animation.
42+
Note that you should always fix the `y_range` to ensure that your data remains visible throughout the animation.
4243

4344
```python
4445
import plotly.express as px
4546

46-
gapminder = px.data.gapminder()
47+
df = px.data.gapminder()
4748

48-
fig = px.bar(gapminder, x="continent", y="pop", color="continent",
49+
fig = px.bar(df, x="continent", y="pop", color="continent",
4950
animation_frame="year", animation_group="country", range_y=[0,4000000000])
5051
fig.show()
5152
```
@@ -54,32 +55,36 @@ fig.show()
5455

5556
The remainder of this section describes the low-level API for constructing animated figures manually.
5657

57-
5858
#### Frames
59+
5960
Along with `data` and `layout`, `frames` can be added as a key in a figure object. The `frames` key points to a list of figures, each of which will be cycled through when animation is triggered.
6061

6162
<!-- #region -->
63+
6264
#### Adding Control Buttons to Animations
65+
6366
You can add play and pause buttons to control your animated charts by adding an `updatemenus` array to the `layout` of your `figure`. More information on style and placement of the buttons is available in Plotly's [`updatemenus` reference](https://plot.ly/python/reference/#layout-updatemenus).
6467
<br>
6568
The buttons are defined as follows:
69+
6670
```
6771
"updatemenus": [{"type": "buttons",
6872
"buttons": [{"label": "Your Label",
6973
"method": "animate",
7074
"args": [See Below]}]}]
7175
```
76+
7277
<!-- #endregion -->
7378

7479
#### Defining Button Arguments
80+
7581
- `None`: Setting `"args"` to undefined (i.e. `"args": [None]`) will create a simple play button that will animate all frames.
7682
- string: Animate all frames with group `"<some string>"`. This is a way of scoping the animations in case you would prefer to animate without explicitly enumerating all frames.
7783
- `["frame1", "frame2", ...]`: Animate a sequence of named frames.
7884
- `[{data: [], layout: {}, traces: []}, {...}]`: Nearly identical to animating named frames; though this variant lets you inline data instead of adding it as named frames. This can be useful for interaction where it's undesirable to add and manage named frames for ephemeral changes.
7985
- `[null]`: A simple way to create a pause button (requires `mode: "immediate"`). This argument dumps the currently queued frames (`mode: "immediate"`), and then animates an empty sequence of frames (`[null]`).
8086
- <b>Please Note:</b> We <b>do not</b> recommend using: `[ ]`. This syntax may cause confusion because it looks indistinguishable from a "pause button", but nested properties have logic that treats empty arrays as entirely removable, so it will function as a play button.<br><br>
81-
Refer to the examples below to see the buttons in action!
82-
87+
Refer to the examples below to see the buttons in action!
8388

8489
#### Simple Play Button
8590

@@ -224,6 +229,7 @@ fig.show()
224229
```
225230

226231
#### Using a Slider and Buttons
232+
227233
The following example uses the well known [Gapminder dataset](https://www.gapminder.org/tag/gdp-per-capita/) to exemplify animation capabilities. This bubble chart animation shows the change in 'GDP per Capita' against the 'Life Expectancy' of several countries from the year 1952 to 2007, colored by their respective continent and sized by population.
228234

229235
This is also an example of building up the structure of a figure as a Python dictionary, and then constructing a graph object figure from that dictionary.
@@ -378,9 +384,10 @@ fig.show()
378384
```
379385

380386
#### Important Notes
381-
- Defining `redraw`: Setting `redraw: false` is an optimization for scatter plots so that animate just makes changes without redrawing the whole plot. For other plot types, such as contour plots, every frame <b>must</b> be a total plot redraw, i.e. `redraw: true`.
382387

388+
- Defining `redraw`: Setting `redraw: false` is an optimization for scatter plots so that animate just makes changes without redrawing the whole plot. For other plot types, such as contour plots, every frame <b>must</b> be a total plot redraw, i.e. `redraw: true`.
383389

384390
#### Reference
391+
385392
For additional information and attributes for creating bubble charts in Plotly see: https://plot.ly/python/bubble-charts/.
386393
For more documentation on creating animations with Plotly, see https://plot.ly/python/#animations.

Diff for: doc/python/annotated_heatmap.md renamed to doc/python/annotated-heatmap.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jupyter:
2929
name: Annotated Heatmaps
3030
order: 8
3131
page_type: u-guide
32-
permalink: python/annotated_heatmap/
32+
permalink: python/annotated-heatmap/
33+
redirect_from: python/annotated_heatmap/
3334
thumbnail: thumbnail/ann_heat.jpg
3435
---
3536

0 commit comments

Comments
 (0)