File size: 1,195 Bytes
758d5fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import streamlit as st
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, HoverTool

# Example data
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)

# Create figure
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)

# Display the Bokeh figure in Streamlit
st.bokeh_chart(p)