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

V4.3 docs#192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolaskruchten merged 24 commits intomasterfromv4.3-docs
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
24 commits
Select commitHold shift + click to select a range
cfac436
new tutorial on displaying image data
emmanuelleNov 1, 2019
2056d13
minor changes
emmanuelleNov 5, 2019
6ac3f3d
Document simple_white template
joelostblomNov 5, 2019
dbbfad2
Change number of themes
joelostblomNov 5, 2019
10d64b9
minor changes
emmanuelleNov 6, 2019
4654c06
updated how to disable ticks
emmanuelleNov 6, 2019
f97dfc4
zmax update
emmanuelleNov 7, 2019
1aa14f0
Merge pull request #169 from joelostblom/Document-simple_white-template
nicolaskruchtenNov 11, 2019
e41bc91
Merge branch 'master' into v4.3-docs
nicolaskruchtenNov 12, 2019
878d394
Update animations.md
nicolaskruchtenNov 11, 2019
d39828e
added example about facet_col_wrap, and one example for disabling axi…
emmanuelleNov 4, 2019
2b03f57
unmatched facet warning
nicolaskruchtenNov 12, 2019
7756589
Merge pull request #166 from plotly/facet_col_wrap
nicolaskruchtenNov 12, 2019
4f3bc89
new tutorial on displaying image data
emmanuelleNov 1, 2019
67c1830
minor changes
emmanuelleNov 5, 2019
cc59b3c
minor changes
emmanuelleNov 6, 2019
9d01e29
updated how to disable ticks
emmanuelleNov 6, 2019
4e93741
zmax update
emmanuelleNov 7, 2019
7696258
Merge branch 'image' of https://github.com/plotly/plotly.py-docs into…
emmanuelleNov 12, 2019
bd06f3b
fix color_continuous_scale
emmanuelleNov 12, 2019
46a3a33
Merge pull request #163 from plotly/image
nicolaskruchtenNov 12, 2019
89e1943
Merge branch 'master' into v4.3-docs
nicolaskruchtenNov 12, 2019
01adb32
fixing kwarg error
nicolaskruchtenNov 12, 2019
43d1ed1
fixing duplicate permalink
nicolaskruchtenNov 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletionpython/animations.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ jupyter:
#### Animated figures with Plotly Express
Several Plotly Express functions support the creation of animated figures through the `animation_frame` and `animation_group` arguments.

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

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

#### Animated Bar Charts with Plotly Express

Note that you should always fix the `y_range` to ensure that your data remains visible throughout the animation.

```python
import plotly.express as px

gapminder = px.data.gapminder()

fig = px.bar(gapminder, x="continent", y="pop", color="continent",
animation_frame="year", animation_group="country", range_y=[0,4000000000])
fig.show()
```

#### Animated figures with Graph Objects

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


Expand Down
38 changes: 37 additions & 1 deletionpython/facet-plots.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.6.7
version: 3.6.8
plotly:
description: How to make Facet and Trellis Plots in Python with Plotly.
display_as: statistical
Expand DownExpand Up@@ -58,6 +58,18 @@ fig = px.bar(tips, x="size", y="total_bill", color="sex", facet_row="smoker")
fig.show()
```

### Wrapping Column Facets

When the facet dimension has a large number of unique values, it is possible to wrap columns using the `facet_col_wrap` argument.

```python
import plotly.express as px
df = px.data.gapminder()
fig = px.scatter(df, x='gdpPercap', y='lifeExp', color='continent', size='pop',
facet_col='year', facet_col_wrap=4)
fig.show()
```

### Histogram Facet Grids

```python
Expand All@@ -67,3 +79,27 @@ fig = px.histogram(tips, x="total_bill", y="tip", color="sex", facet_row="time",
category_orders={"day": ["Thur", "Fri", "Sat", "Sun"], "time": ["Lunch", "Dinner"]})
fig.show()
```

### Facets with independent axes

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.

```python
import plotly.express as px
df = px.data.tips()
fig = px.scatter(df, x="total_bill", y="tip", color='sex', facet_row="day")
fig.update_yaxes(matches=None)
fig.show()
```

```python
import plotly.express as px
df = px.data.tips()
fig = px.scatter(df, x="total_bill", y="tip", color='sex', facet_col="day")
fig.update_xaxes(matches=None)
fig.show()
```

```python

```
47 changes: 22 additions & 25 deletionspython/images.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.1'
jupytext_version: 1.1.7
jupytext_version: 1.1.1
kernelspec:
display_name: Python 3
language: python
Expand All@@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.6.5
version: 3.7.3
plotly:
description: How to add images to charts as background images or logos.
display_as: file_settings
Expand All@@ -30,10 +30,13 @@ jupyter:
order: 31
permalink: python/images/
thumbnail: thumbnail/images.png
v4upgrade: true
---

#### Add a Background Image

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

```python
import plotly.graph_objects as go

Expand All@@ -46,8 +49,7 @@ fig.add_trace(
)

# Add images
fig.update_layout(
images=[
fig.add_layout_image(
go.layout.Image(
source="https://images.plot.ly/language-icons/api-home/python-logo.png",
xref="x",
Expand All@@ -59,7 +61,6 @@ fig.update_layout(
sizing="stretch",
opacity=0.5,
layer="below")
]
)

# Set templates
Expand DownExpand Up@@ -112,14 +113,14 @@ fig.add_trace(
)

# Add image
fig.update_layout(
images=[dict(
fig.add_layout_image(
dict(
source="https://raw.githubusercontent.com/cldougl/plot_images/add_r_img/vox.png",
xref="paper", yref="paper",
x=1, y=1.05,
sizex=0.2, sizey=0.2,
xanchor="right", yanchor="bottom"
)],
)
)

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

# Add images
fig.update_layout(
images=[go.layout.Image(
fig.add_layout_image(
go.layout.Image(
source="https://raw.githubusercontent.com/michaelbabyn/plot_data/master/benzene.png",
xref="paper",
yref="paper",
x=0.75,
y=0.65,
sizex=0.3,
sizey=0.3,
xanchor="right",
yanchor="bottom"
), go.layout.Image(
))
fig.add_layout_image(go.layout.Image(
source="https://raw.githubusercontent.com/michaelbabyn/plot_data/master/naphthalene.png",
xref="paper",
yref="paper",
x=0.9,
y=0.3,
)
)
fig.update_layout_images(dict(
xref="paper",
yref="paper",
sizex=0.3,
sizey=0.3,
xanchor="right",
yanchor="bottom"
)
]
)
))

# Add annotations
fig.update_layout(
Expand DownExpand Up@@ -277,8 +274,8 @@ fig.update_yaxes(
)

# Add image
fig.update_layout(
images=[go.layout.Image(
fig.add_layout_image(
go.layout.Image(
x=0,
sizex=img_width * scale_factor,
y=img_height * scale_factor,
Expand All@@ -288,7 +285,7 @@ fig.update_layout(
opacity=1.0,
layer="below",
sizing="stretch",
source="https://raw.githubusercontent.com/michaelbabyn/plot_data/master/bridge.jpg")]
source="https://raw.githubusercontent.com/michaelbabyn/plot_data/master/bridge.jpg")
)

# Configure other layout
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp