Skip to content

Commit d76273c

Browse files
committed
Merge branch 'doc-prod'
2 parents 9d7b650 + cf181d3 commit d76273c

File tree

5 files changed

+31
-20
lines changed

5 files changed

+31
-20
lines changed

Diff for: doc/python/animations.md

-12
Original file line numberDiff line numberDiff line change
@@ -261,18 +261,6 @@ fig_dict = {
261261
fig_dict["layout"]["xaxis"] = {"range": [30, 85], "title": "Life Expectancy"}
262262
fig_dict["layout"]["yaxis"] = {"title": "GDP per Capita", "type": "log"}
263263
fig_dict["layout"]["hovermode"] = "closest"
264-
fig_dict["layout"]["sliders"] = {
265-
"args": [
266-
"transition", {
267-
"duration": 400,
268-
"easing": "cubic-in-out"
269-
}
270-
],
271-
"initialValue": "1952",
272-
"plotlycommand": "animate",
273-
"values": years,
274-
"visible": True
275-
}
276264
fig_dict["layout"]["updatemenus"] = [
277265
{
278266
"buttons": [

Diff for: doc/python/datashader.md

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

3737
[datashader](https://datashader.org/) creates rasterized representations of large datasets for easier visualization, with a pipeline approach consisting of several steps: projecting the data on a regular grid, creating a color representation of the grid, etc.
3838

39-
### Passing datashader rasters as a mabox image layer
39+
### Passing datashader rasters as a mapbox image layer
4040

4141
We visualize here the spatial distribution of taxi rides in New York City. A higher density
4242
is observed on major avenues. For more details about mapbox charts, see [the mapbox layers tutorial](/python/mapbox-layers). No mapbox token is needed here.

Diff for: doc/python/legend.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fig.add_trace(go.Scatter(
159159
name="Decreasing"
160160
))
161161

162-
fig.update_layout(legend_title='<b> Trend </b>')
162+
fig.update_layout(legend_title_text='Trend')
163163
fig.show()
164164
```
165165

Diff for: doc/python/sliders.md

+28-5
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jupyter:
3333
thumbnail: thumbnail/slider2017.gif
3434
---
3535

36-
#### Simple Slider Control
37-
Sliders can now be used in Plotly to change the data displayed or style of a plot!
36+
### Simple Slider Control
37+
Sliders can be used in Plotly to change the data displayed or style of a plot.
3838

3939
```python
4040
import plotly.graph_objects as go
@@ -60,10 +60,11 @@ fig.data[10].visible = True
6060
steps = []
6161
for i in range(len(fig.data)):
6262
step = dict(
63-
method="restyle",
64-
args=["visible", [False] * len(fig.data)],
63+
method="update",
64+
args=[{"visible": [False] * len(fig.data)},
65+
{"title": "Slider switched to step: " + str(i)}], # layout attribute
6566
)
66-
step["args"][1][i] = True # Toggle i'th trace to "visible"
67+
step["args"][0]["visible"][i] = True # Toggle i'th trace to "visible"
6768
steps.append(step)
6869

6970
sliders = [dict(
@@ -80,5 +81,27 @@ fig.update_layout(
8081
fig.show()
8182
```
8283

84+
#### Methods
85+
The method determines which [plotly.js function](https://plot.ly/javascript/plotlyjs-function-reference/) will be used to update the chart. Plotly can use several [updatemenu](https://plot.ly/python/reference/#layout-updatemenus-items-updatemenu-buttons-items-button-method) methods to add the slider:
86+
- `"restyle"`: modify **data** attributes
87+
- `"relayout"`: modify **layout** attributes
88+
- `"update"`: modify **data and layout** attributes
89+
- `"animate"`: start or pause an animation
90+
91+
### Sliders in Plotly Express
92+
Plotly Express provide sliders, but with implicit animation. The animation can be ommited by removing `updatemenus` in the `layout`:
93+
94+
```python
95+
import plotly.express as px
96+
97+
df = px.data.gapminder()
98+
fig = px.scatter(df, x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country",
99+
size="pop", color="continent", hover_name="country",
100+
log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])
101+
102+
fig["layout"].pop("updatemenus") # optional, drop animation buttons
103+
fig.show()
104+
```
105+
83106
#### Reference
84107
Check out https://plotly.com/python/reference/#layout-updatemenus for more information!

Diff for: doc/python/sunburst-charts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ fig.show()
196196

197197
With branchvalues "total", the value of the parent represents the width of its wedge. In the example below, "Enoch" is 4 and "Awan" is 6 and so Enoch's width is 4/6ths of Awans. With branchvalues "remainder", the parent's width is determined by its own value plus those of its children. So, Enoch's width is 4/10ths of Awan's (4 / (6 + 4)).
198198

199-
Note that this means that the sum of the values of the children cannot exceed the value of their parent when branchvalues "total". When branchvalues "relative" (the default), children will not take up all of the space below their parent (unless the parent is the root and it has a value of 0).
199+
Note that this means that the sum of the values of the children cannot exceed the value of their parent when branchvalues is set to "total". When branchvalues is set to "remainder" (the default), children will not take up all of the space below their parent (unless the parent is the root and it has a value of 0).
200200

201201
```python
202202
import plotly.graph_objects as go

0 commit comments

Comments
 (0)