CARVIEW |
Select Language
HTTP/2 200
accept-ranges: bytes
access-control-allow-origin: *
age: 191
cache-control: max-age=600
content-encoding: gzip
content-type: text/html; charset=utf-8
date: Tue, 14 Oct 2025 05:56:04 GMT
etag: W/"68e952e3-179304b"
expires: Tue, 14 Oct 2025 06:00:33 GMT
last-modified: Fri, 10 Oct 2025 18:39:31 GMT
server: Vercel
strict-transport-security: max-age=63072000
vary: Accept-Encoding
via: 1.1 varnish
x-cache: HIT
x-cache-hits: 0
x-fastly-request-id: 0a38b086cb556e9b70dd628785a0bf3b5ad7c3de
x-github-request-id: 2D2E:3E15A8:33570:406DA:68EDE4A9
x-origin-cache: HIT
x-proxy-cache: MISS
x-robots-tag: index
x-served-by: cache-bom-vanm7210022-BOM
x-timer: S1760421364.044979,VS0,VE1
x-vercel-cache: MISS
x-vercel-id: bom1::c24rj-1760421364030-ebfa0216ad3f
content-length: 16656217
Imshow in Python
Imshow in Python
How to display image data in Python with Plotly.
Plotly Studio: Transform any dataset into an interactive data application in minutes with AI. Try Plotly Studio now.
In [1]:
import plotly.express as px
import numpy as np
img_rgb = np.array([[[255, 0, 0], [0, 255, 0], [0, 0, 255]],
[[0, 255, 0], [0, 0, 255], [255, 0, 0]]
], dtype=np.uint8)
fig = px.imshow(img_rgb)
fig.show()
Read image arrays from image files¶
In order to create a numerical array to be passed to px.imshow
, you can use a third-party library like PIL, scikit-image or opencv. We show below how to open an image from a file with skimage.io.imread
, and alternatively how to load a demo image from skimage.data
.
In [2]:
import plotly.express as px
from skimage import io
img = io.imread('https://user-images.githubusercontent.com/72614349/179115668-2630e3e4-3a9f-4c88-9494-3412e606450a.jpg')
fig = px.imshow(img)
fig.show()