Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitbcdce8e

Browse files
Merge pull request#192 from plotly/v4.3-docs
V4.3 docs
2 parents4ad946f +43d1ed1 commitbcdce8e

File tree

5 files changed

+270
-31
lines changed

5 files changed

+270
-31
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.expressas 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.expressas 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",range_y=[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

‎python/facet-plots.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jupyter:
2020
name:python
2121
nbconvert_exporter:python
2222
pygments_lexer:ipython3
23-
version:3.6.7
23+
version:3.6.8
2424
plotly:
2525
description:How to make Facet and Trellis Plots in Python with Plotly.
2626
display_as:statistical
@@ -58,6 +58,18 @@ fig = px.bar(tips, x="size", y="total_bill", color="sex", facet_row="smoker")
5858
fig.show()
5959
```
6060

61+
###Wrapping Column Facets
62+
63+
When the facet dimension has a large number of unique values, it is possible to wrap columns using the`facet_col_wrap` argument.
64+
65+
```python
66+
import plotly.expressas px
67+
df= px.data.gapminder()
68+
fig= px.scatter(df,x='gdpPercap',y='lifeExp',color='continent',size='pop',
69+
facet_col='year',facet_col_wrap=4)
70+
fig.show()
71+
```
72+
6173
###Histogram Facet Grids
6274

6375
```python
@@ -67,3 +79,27 @@ fig = px.histogram(tips, x="total_bill", y="tip", color="sex", facet_row="time",
6779
category_orders={"day": ["Thur","Fri","Sat","Sun"],"time": ["Lunch","Dinner"]})
6880
fig.show()
6981
```
82+
83+
###Facets with independent axes
84+
85+
By default, facet axes are linked together: zooming inside one of the facets will also zoom in the other facets. You can disable this behaviour when you use`facet_row` only, by disabling`matches` on the Y axes, or when using`facet_col` only, by disabling`matches` on the X axes. It is not recommended to use this approach when using`facet_row` and`facet_col` together, as in this case it becomes very hard to understand the labelling of axes and grid lines.
86+
87+
```python
88+
import plotly.expressas px
89+
df= px.data.tips()
90+
fig= px.scatter(df,x="total_bill",y="tip",color='sex',facet_row="day")
91+
fig.update_yaxes(matches=None)
92+
fig.show()
93+
```
94+
95+
```python
96+
import plotly.expressas px
97+
df= px.data.tips()
98+
fig= px.scatter(df,x="total_bill",y="tip",color='sex',facet_col="day")
99+
fig.update_xaxes(matches=None)
100+
fig.show()
101+
```
102+
103+
```python
104+
105+
```

‎python/images.md

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension:.md
77
format_name:markdown
88
format_version:'1.1'
9-
jupytext_version:1.1.7
9+
jupytext_version:1.1.1
1010
kernelspec:
1111
display_name:Python 3
1212
language:python
@@ -20,7 +20,7 @@ jupyter:
2020
name:python
2121
nbconvert_exporter:python
2222
pygments_lexer:ipython3
23-
version:3.6.5
23+
version:3.7.3
2424
plotly:
2525
description:How to add images to charts as background images or logos.
2626
display_as:file_settings
@@ -30,10 +30,13 @@ jupyter:
3030
order:31
3131
permalink:python/images/
3232
thumbnail:thumbnail/images.png
33+
v4upgrade:true
3334
---
3435

3536
####Add a Background Image
3637

38+
In this page we explain how to add static, non-interactive images as background, logo or annotation images to a figure. For exploring image data in interactive charts, see the[tutorial on displaying image data](/python/imshow).
39+
3740
```python
3841
import plotly.graph_objectsas go
3942

@@ -46,8 +49,7 @@ fig.add_trace(
4649
)
4750

4851
# Add images
49-
fig.update_layout(
50-
images=[
52+
fig.add_layout_image(
5153
go.layout.Image(
5254
source="https://images.plot.ly/language-icons/api-home/python-logo.png",
5355
xref="x",
@@ -59,7 +61,6 @@ fig.update_layout(
5961
sizing="stretch",
6062
opacity=0.5,
6163
layer="below")
62-
]
6364
)
6465

6566
# Set templates
@@ -112,14 +113,14 @@ fig.add_trace(
112113
)
113114

114115
# Add image
115-
fig.update_layout(
116-
images=[dict(
116+
fig.add_layout_image(
117+
dict(
117118
source="https://raw.githubusercontent.com/cldougl/plot_images/add_r_img/vox.png",
118119
xref="paper",yref="paper",
119120
x=1,y=1.05,
120121
sizex=0.2,sizey=0.2,
121122
xanchor="right",yanchor="bottom"
122-
)],
123+
)
123124
)
124125

125126
# update layout properties
@@ -171,30 +172,26 @@ for (x, y), n in zip(simulated_absorptions, names):
171172
fig.add_trace(go.Scatter(x=x,y=y,name=n))
172173

173174
# Add images
174-
fig.update_layout(
175-
images=[go.layout.Image(
175+
fig.add_layout_image(
176+
go.layout.Image(
176177
source="https://raw.githubusercontent.com/michaelbabyn/plot_data/master/benzene.png",
177-
xref="paper",
178-
yref="paper",
179178
x=0.75,
180179
y=0.65,
181-
sizex=0.3,
182-
sizey=0.3,
183-
xanchor="right",
184-
yanchor="bottom"
185-
), go.layout.Image(
180+
))
181+
fig.add_layout_image(go.layout.Image(
186182
source="https://raw.githubusercontent.com/michaelbabyn/plot_data/master/naphthalene.png",
187-
xref="paper",
188-
yref="paper",
189183
x=0.9,
190184
y=0.3,
185+
)
186+
)
187+
fig.update_layout_images(dict(
188+
xref="paper",
189+
yref="paper",
191190
sizex=0.3,
192191
sizey=0.3,
193192
xanchor="right",
194193
yanchor="bottom"
195-
)
196-
]
197-
)
194+
))
198195

199196
# Add annotations
200197
fig.update_layout(
@@ -277,8 +274,8 @@ fig.update_yaxes(
277274
)
278275

279276
# Add image
280-
fig.update_layout(
281-
images=[go.layout.Image(
277+
fig.add_layout_image(
278+
go.layout.Image(
282279
x=0,
283280
sizex=img_width* scale_factor,
284281
y=img_height* scale_factor,
@@ -288,7 +285,7 @@ fig.update_layout(
288285
opacity=1.0,
289286
layer="below",
290287
sizing="stretch",
291-
source="https://raw.githubusercontent.com/michaelbabyn/plot_data/master/bridge.jpg")]
288+
source="https://raw.githubusercontent.com/michaelbabyn/plot_data/master/bridge.jpg")
292289
)
293290

294291
# Configure other layout

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp