|
import streamlit as st |
|
from bokeh.plotting import figure |
|
from bokeh.models import ColumnDataSource, HoverTool |
|
|
|
|
|
data = { |
|
'x': [1, 2, 3, 4, 5], |
|
'y': [10, 14, 20, 25, 30], |
|
'label': ['Point 1', 'Point 2', 'Point 3', 'Point 4', 'Point 5'], |
|
'image': [ |
|
'https://media-img.lucyinthesky.com/data/Nov24/560xAUTO/17157eb1-aba8-4161-8a44-2dd3bd73a5ff.jpg', |
|
'https://media-img.lucyinthesky.com/data/Nov24/560xAUTO/dfd0c2d3-af96-4700-8fb2-cccc585c0e8b.jpg', |
|
'https://media-img.lucyinthesky.com/data/Nov24/560xAUTO/ef942b7d-52ad-415b-ae88-c7c29a2491b4.jpg', |
|
'https://media-img.lucyinthesky.com/data/Nov24/560xAUTO/047928d0-9168-4d29-84a5-785aec57dd6b.jpg', |
|
'https://media-img.lucyinthesky.com/data/Nov24/560xAUTO/03054e31-3812-454a-bc3a-0ff207798927.jpg' |
|
] |
|
} |
|
|
|
source = ColumnDataSource(data=data) |
|
|
|
|
|
p = figure(title="Scatter Plot with Image Hover", tools="hover", tooltips=""" |
|
<div> |
|
<div><strong>@label</strong></div> |
|
<div><img src="@image" style="width:200px;height:200px;"></div> |
|
</div> |
|
""") |
|
p.circle('x', 'y', size=10, source=source) |
|
|
|
|
|
st.bokeh_chart(p) |
|
|