DashIntro icon indicating copy to clipboard operation
DashIntro copied to clipboard

Error in update graph for Tutorial

Open dredvard opened this issue 6 years ago • 0 comments

The code xref =""x" not "y". Should be updated to the following:

def update_graph(x_val, y_val): traces = [go.Heatmap(z=_simple_image(x_val, y_val, as_uri = False), #colorscale='Viridis' )] if (x_val>0) or (y_val>0): traces += [go.Scatter(x = [x_val], y = [y_val])]

layout = go.Layout(
    #images= [_simple_image(x_val,y_val)],
    annotations=[
    dict(                            # all "annotation" attributes: /python/reference/#layout-annotations
        text="Current Position ({}, {})".format(x_val, y_val),    # /python/reference/#layout-annotations-text
        x=x_val,                         # /python/reference/#layout-annotations-x
        xref="x",                # /python/reference/#layout-annotations-xref
        y=y_val,                         # /python/reference/#layout-annotations-y
        yref="y"                 # /python/reference/#layout-annotations-yref
    )
]
                  )
return dict(data = traces, layout=layout)

dredvard avatar Aug 30 '18 21:08 dredvard