8000 Update animations.md · plotly/plotly.py-docs@878d394 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 878d394

Browse files
Update animations.md
1 parent e41bc91 commit 878d394

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

python/animations.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jupyter:
2626
#### Animated figures with Plotly Express
2727
Several Plotly Express functions support the creation of animated figures through the `animation_frame` and `animation_group` arguments.
2828

29-
Here is an example of an animated scatter plot creating using Plotly Express
29+
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.
3030

3131
```python
3232
import plotly.express as px
@@ -36,6 +36,22 @@ px.scatter(gapminder, x="gdpPercap", y="lifeExp", animation_frame="year", animat
3636
log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])
3737
```
3838

39+
#### Animated Bar Charts with Plotly Express
40+
41+
Note that you should always fix the `y_range` to ensure that your data remains visible throughout the animation.
42+
43+
```python
44+
import plotly.express as px
45+
46+
gapminder = px.data.gapminder()
47+
48+
fig = px.bar(gapminder, x="continent", y="pop", color="continent",
49+
animation_frame="year", animation_group="country", y_range=[0,4000000000])
50+
fig.show()
51+
```
52+
53+
#### Animated figures with Graph Objects
54+
3955
The remainder of this section describes the low-level API for constructing animated figures manually.
4056

4157

0 commit comments

Comments
 (0)
0