Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Nov 12, 2019
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cfac436
new tutorial on displaying image data
emmanuelle Nov 1, 2019
2056d13
minor changes
emmanuelle Nov 5, 2019
6ac3f3d
Document simple_white template
joelostblom Nov 5, 2019
dbbfad2
Change number of themes
joelostblom Nov 5, 2019
10d64b9
minor changes
emmanuelle Nov 6, 2019
4654c06
updated how to disable ticks
emmanuelle Nov 6, 2019
f97dfc4
zmax update
emmanuelle Nov 7, 2019
1aa14f0
Merge pull request #169 from joelostblom/Document-simple_white-template
nicolaskruchten Nov 11, 2019
e41bc91
Merge branch 'master' into v4.3-docs
nicolaskruchten Nov 12, 2019
878d394
Update animations.md
nicolaskruchten Nov 11, 2019
d39828e
added example about facet_col_wrap, and one example for disabling axi…
emmanuelle Nov 4, 2019
2b03f57
unmatched facet warning
nicolaskruchten Nov 12, 2019
7756589
Merge pull request #166 from plotly/facet_col_wrap
nicolaskruchten Nov 12, 2019
4f3bc89
new tutorial on displaying image data
emmanuelle Nov 1, 2019
67c1830
minor changes
emmanuelle Nov 5, 2019
cc59b3c
minor changes
emmanuelle Nov 6, 2019
9d01e29
updated how to disable ticks
emmanuelle Nov 6, 2019
4e93741
zmax update
emmanuelle Nov 7, 2019
7696258
Merge branch 'image' of https://github.com/plotly/plotly.py-docs into…
emmanuelle Nov 12, 2019
bd06f3b
fix color_continuous_scale
emmanuelle Nov 12, 2019
46a3a33
Merge pull request #163 from plotly/image
nicolaskruchten Nov 12, 2019
89e1943
Merge branch 'master' into v4.3-docs
nicolaskruchten Nov 12, 2019
01adb32
fixing kwarg error
nicolaskruchten Nov 12, 2019
43d1ed1
fixing duplicate permalink
nicolaskruchten Nov 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
Prev Previous commit
fixing duplicate permalink
  • Loading branch information
nicolaskruchten committed Nov 12, 2019
commit 43d1ed12edf3fe85a7cf4e36ea016c2a445920b0
11 changes: 5 additions & 6 deletions python/imshow.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jupyter:
order: 3
page_type: example_index
permalink: python/imshow/
redirect_from: python/imshow/
thumbnail: thumbnail/imshow.jpg
v4upgrade: true
---
Expand Down Expand Up @@ -77,7 +76,7 @@ fig.show()

### Display single-channel 2D image as grayscale

For a 2D image, `px.imshow` uses a colorscale to map scalar data to colors. The default colorscale is the one of the active template (see [the tutorial on templates](/python/templates/)).
For a 2D image, `px.imshow` uses a colorscale to map scalar data to colors. The default colorscale is the one of the active template (see [the tutorial on templates](/python/templates/)).

```python
import plotly.express as px
Expand All @@ -102,7 +101,7 @@ fig.show()

It is also possible to use the `go.Image` trace from the low-level `graph_objects` API in order to display image data. Note that `go.Image` only accepts multichannel images. For single images, use [`go.Heatmap`](/python/heatmaps).

Note that the `go.Image` trace is different from the `go.layout.Image` class, which can be used for [adding background images or logos to figures](/python/images).
Note that the `go.Image` trace is different from the `go.layout.Image` class, which can be used for [adding background images or logos to figures](/python/images).

```python
import plotly.graph_objects as go
Expand All @@ -114,7 +113,7 @@ fig.show()

### Defining the data range covered by the color range with zmin and zmax

The data range and color range are mapped together using the parameters `zmin` and `zmax`, which correspond respectively to the data values mapped to black `[0, 0, 0]` and white `[255, 255, 255]`, or to the extreme colors of the colorscale in the case on single-channel data.
The data range and color range are mapped together using the parameters `zmin` and `zmax`, which correspond respectively to the data values mapped to black `[0, 0, 0]` and white `[255, 255, 255]`, or to the extreme colors of the colorscale in the case on single-channel data.

For single-channel data, the defaults values of `zmin` and `zmax` used by `px.imshow` and `go.Heatmap` are the extrema of the data range. For multichannel data, `px.imshow` and `go.Image` use slightly different default values for `zmin` and `zmax`. For `go.Image`, the default value is `zmin=[0, 0, 0]` and `zmax=[255, 255, 255]`, no matter the data type. On the other hand, `px.imshow` adapts the default `zmin` and `zmax` to the data type:
- for integer data types, `zmin` and `zmax` correspond to the extreme values of the data type, for example 0 and 255 for `uint8`, 0 and 65535 for `uint16`, etc.
Expand Down Expand Up @@ -163,7 +162,7 @@ import plotly.graph_objects as go
from skimage import data
img = data.camera()
fig = px.imshow(img, color_continuous_scale='gray')
fig.add_trace(go.Contour(z=img, showscale=False,
fig.add_trace(go.Contour(z=img, showscale=False,
contours=dict(start=0, end=70, size=70, coloring='lines'),
line_width=2))
fig.add_trace(go.Scatter(x=[230], y=[100], marker=dict(color='red', size=16)))
Expand All @@ -180,7 +179,7 @@ fig = make_subplots(1, 2)
# We use go.Image because subplots require traces, whereas px functions return a figure
fig.add_trace(go.Image(z=img), 1, 1)
for channel, color in enumerate(['red', 'green', 'blue']):
fig.add_trace(go.Histogram(x=img[..., channel].ravel(), opacity=0.5,
fig.add_trace(go.Histogram(x=img[..., channel].ravel(), opacity=0.5,
marker_color=color, name='%s channel' %color), 1, 2)
fig.update_layout(height=400)
fig.show()
Expand Down