Plotting a 2D heatmap


I am trying to plot a 2D heatmap like official documents:

import plotly.graph_objects as go

fig = go.Figure(data=go.Heatmap(
                z=[[1, 20, 30],
                  [20, 1, 60],
                  [30, 60, 1]]))

but it doesn’t work…

    Invalid value of type 'plotly.graph_objs.Heatmap' received for the 'data' property of 
        Received value: Heatmap({
    'z': [[1, 20, 30], [20, 1, 60], [30, 60, 1]]

The 'data' property is a tuple of trace instances
that may be specified as:
  - A list or tuple of trace instances
    (e.g. [Scatter(...), Bar(...)])
  - A list or tuple of dicts of string/value properties where:
    - The 'type' property specifies the trace type
        One of: ['area', 'bar', 'barpolar', 'box',
                 'candlestick', 'carpet', 'choropleth', 'cone',
                 'contour', 'contourcarpet', 'funnel',
                 'funnelarea', 'heatmap', 'heatmapgl',
                 'histogram', 'histogram2d',
                 'histogram2dcontour', 'isosurface', 'mesh3d',
                 'ohlc', 'parcats', 'parcoords', 'pie',
                 'pointcloud', 'sankey', 'scatter',
                 'scatter3d', 'scattercarpet', 'scattergeo',
                 'scattergl', 'scattermapbox', 'scatterpolar',
                 'scatterpolargl', 'scatterternary', 'splom',
                 'streamtube', 'sunburst', 'surface', 'table',
                 'violin', 'volume', 'waterfall']

    - All remaining properties are passed to the constructor of
      the specified trace type

    (e.g. [{'type': 'scatter', ...}, {'type': 'bar, ...}])

Could you give me some advices for me ?
Best Regards

@oyoroco, what version of are you using? The syntax above will only work with v4 or greater of You can find out with either pip list or conda list (depending on which one you use) and upgrade it with pip install plotly==4.0.0 or conda install plotly==4.0.0

@michaelbabyn, I used plotly 3.10.0… I upgraded it and it works.
Thank you for your quick response and help!!!