Skip to content

Commit 1d1620c

Browse files
committed
Fixed html image rendering and reading image from wikimedia
1 parent 77e76af commit 1d1620c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

doc/python/figurewidget-app.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ widgets.VBox([container,
154154
g])
155155
```
156156

157-
```html
157+
158158
<img src = 'https://cloud.githubusercontent.com/assets/12302455/16637308/4e476280-43ac-11e6-9fd3-ada2c9506ee1.gif' >
159-
```
159+
160160

161161
#### Reference
162162

doc/python/plotly-express.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,13 @@ Plotly Express provides [more than 30 functions for creating different types of
4242

4343
Here is a talk from the [SciPy 2021 conference](https://www.scipy2021.scipy.org/) that gives a good introduction to Plotly Express and [Dash](https://dash.plotly.com/):
4444

45-
```html hide_code=true
4645
<div align="center">
4746
<iframe width="560" height="315"
4847
src="https://www.youtube.com/embed/FpCgG85g2Hw"
4948
title="Data Visualization as The First and Last Mile of Data Science: Plotly Express and Dash | SciPy 2021"
5049
frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
5150
</div>
52-
```
51+
5352

5453
Plotly Express currently includes the following functions:
5554

@@ -386,7 +385,13 @@ fig.show()
386385
```python
387386
import plotly.express as px
388387
from skimage import io
389-
img = io.imread('https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/240px-Crab_Nebula.jpg')
388+
from io import BytesIO
389+
import requests
390+
391+
url = 'https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/240px-Crab_Nebula.jpg'
392+
headers = {"User-Agent": "Mozilla/5.0"}
393+
response = requests.get(url, headers=headers)
394+
img = io.imread(BytesIO(response.content))
390395
fig = px.imshow(img)
391396
fig.show()
392397
```

0 commit comments

Comments
 (0)