Skip to content

Error in update graph for Tutorial #5

@dredvard

Description

@dredvard

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions