Skip to content

Cannot convert matplotlib heat map to pyplot #5048

@jacobromero

Description

@jacobromero

While trying to convert a Matplotlib Heatmap figure to a plotly object I am getting the following message, as well as a blank graph.

UserWarning:

Aw. Snap! You're gonna have to hold off on the selfies for now. Plotly can't import images from matplotlib yet!

UserWarning:

Dang! That path collection is out of this world. I totally don't know what to do with it yet! Plotly can only import path collections linked to 'data' coordinates

Image

This is also happens when trying with seaborn heatmaps as well.


code to reproduce

import plotly.tools as tools
import numpy as np
import matplotlib.pyplot as plt

data = np.random.rand(10, 10)  # 10x10 random matrix

fig1: plt.Figure = plt.figure()
ax1 = plt.imshow(data, cmap='viridis', aspect='equal')
plt.colorbar(ax1)
plt.title('Matplotlib Heatmap')

tools.mpl_to_plotly(fig1)

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