Closed
Description
Codepen here (graph renders, but console error present in browser Dev Tools [not CodePen console])
With v1.58.0
and above, the heatmapgl
trace in combination with layout.xaxis.scaleanchor = 'y'
will result in the following console error:
Uncaught TypeError: Cannot read property 'h' of undefined
at finalRatios (plotly-latest.js:130572)
at enforce (plotly-latest.js:130607)
at Scene2D.proto.plot (plotly-latest.js:141341)
at Object.plot (plotly-latest.js:140826)
at exports.drawData (plotly-latest.js:123232)
at Object.lib.syncOrAsync (plotly-latest.js:112023)
at Object.plot (plotly-latest.js:117778)
at Object.newPlot (plotly-latest.js:118048)
at pen.js?key=pen.js-7e54a372-bf12-b3ca-2352-8ef41ae0d8f6:16
It looks like the height h
is not defined in the yRatio
calculation here and this causes the error.
Also, probably because of the undefined height in a ratio calculation, the way a heatmap is rendered is different in a div
without a defined width (or perhaps other dimensions?) before and after 1.58.0
:
Plotly.js v1.57.1 ('equal' aspect ratio) |
Plotly.js v1.58.0 ('oblong' aspect ratio) |
---|---|
![]() |
![]() |
This is more of a problem for Dash, because it's a render-blocking error.
Dash app (may require login)
Click for Python Dash code
import dash
import dash_core_components as dcc
app = dash.Dash(__name__)
layout = dict(xaxis=dict(scaleanchor='y'))
webgl_heatmap_fig = dict(
data=[
dict(
z=[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
],
type='heatmapgl'
)
],
layout=layout
)
app.layout = dcc.Graph(figure=webgl_heatmap_fig)
if __name__ == '__main__':
app.run_server(debug=True)
cc @plotly/plotly_js