Created
September 14, 2019 09:30
-
-
Save davegreenwood/7f2b41153252998f4b0f47e10e5ad4ca to your computer and use it in GitHub Desktop.
scatter plot over image with point id hover data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from plotly.offline import init_notebook_mode, iplot | |
import plotly.graph_objs as go | |
init_notebook_mode() | |
# x, y is point data, image is a PIL image. | |
trace0 = go.Scatter( | |
x=x, y=y, mode='markers', | |
hovertext=[str(i) for i in range(len(x))], | |
hoverinfo="text",) | |
layout = go.Layout( | |
hovermode="closest", | |
showlegend=False, | |
height=800, | |
width=800, | |
yaxis=go.layout.YAxis(range=[512, 0]), | |
xaxis=go.layout.XAxis(range=[0, 512]), | |
images=[go.layout.Image(source=image, | |
xref="x", | |
yref="y", | |
x=0, | |
y=0, | |
sizex=512, | |
sizey=512, | |
sizing="stretch", | |
opacity=1.0, | |
layer="below")],) | |
fig = go.Figure(data=[trace0], layout=layout) | |
iplot(fig) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment