I want to quickly create heatmaps where I already have proper data for the all the dimensions and do not need any of the preprocessing that comes with px.density_heatmap. So for now it seems that I need to revert to graph_objects to accomplish that, since there is no px.heatmap. Is there a reason for that? Or is it just not ready yet?
Hi @realtime, if your heatmap corresponds to 2d image data, you can use the
px.imshow function which was introduced in plotly 4.3, and works for 2d single-channel or RGB images. The documentation is on https://plot.ly/python/imshow/. However, it makes some opiniated choices for you, like the
[0, 0] element is at the top-left corner (as in an image) and pixels are square. We might extend the API later for a more traditional
px.heatmap, for other data than images.
I found another way, probably (slightly) illegal:
import plotly.express as px iris = px.data.iris() fig = px.scatter_3d(iris, x="sepal_width", y="sepal_length", z="petal_length") fig.data._props['type'] = 'heatmap' fig.show()
The results look as I would expect them to look, but unfortunately the axis titles are lost with that approach.