Skip to content

Commit 43d1ed1

Browse files
fixing duplicate permalink
1 parent 01adb32 commit 43d1ed1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

python/imshow.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ jupyter:
3232
order: 3
3333
page_type: example_index
3434
permalink: python/imshow/
35-
redirect_from: python/imshow/
3635
thumbnail: thumbnail/imshow.jpg
3736
v4upgrade: true
3837
---
@@ -77,7 +76,7 @@ fig.show()
7776

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

80-
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/)).
79+
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/)).
8180

8281
```python
8382
import plotly.express as px
@@ -102,7 +101,7 @@ fig.show()
102101

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

105-
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).
104+
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).
106105

107106
```python
108107
import plotly.graph_objects as go
@@ -114,7 +113,7 @@ fig.show()
114113

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

117-
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.
116+
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.
118117

119118
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:
120119
- 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.
@@ -163,7 +162,7 @@ import plotly.graph_objects as go
163162
from skimage import data
164163
img = data.camera()
165164
fig = px.imshow(img, color_continuous_scale='gray')
166-
fig.add_trace(go.Contour(z=img, showscale=False,
165+
fig.add_trace(go.Contour(z=img, showscale=False,
167166
contours=dict(start=0, end=70, size=70, coloring='lines'),
168167
line_width=2))
169168
fig.add_trace(go.Scatter(x=[230], y=[100], marker=dict(color='red', size=16)))
@@ -180,7 +179,7 @@ fig = make_subplots(1, 2)
180179
# We use go.Image because subplots require traces, whereas px functions return a figure
181180
fig.add_trace(go.Image(z=img), 1, 1)
182181
for channel, color in enumerate(['red', 'green', 'blue']):
183-
fig.add_trace(go.Histogram(x=img[..., channel].ravel(), opacity=0.5,
182+
fig.add_trace(go.Histogram(x=img[..., channel].ravel(), opacity=0.5,
184183
marker_color=color, name='%s channel' %color), 1, 2)
185184
fig.update_layout(height=400)
186185
fig.show()

0 commit comments

Comments
 (0)