title: Plotly: How to make an annotated confusion matrix using a heatmap?
body: <p>I like to use Plotly to visualize everything, I'm trying to visualize a confusion matrix by Plotly, this is my code:</p>
  
  <pre><code>def plot_confusion_matrix(y_true, y_pred, class_names):
      confusion_matrix = metrics.confusion_matrix(y_true, y_pred)
      confusion_matrix = confusion_matrix.astype(int)
  
      layout = {
          "title": "Confusion Matrix", 
          "xaxis": {"title": "Predicted value"}, 
          "yaxis": {"title": "Real value"}
      }
  
      fig = go.Figure(data=go.Heatmap(z=confusion_matrix,
                                      x=class_names,
                                      y=class_names,
                                      hoverongaps=False),
                      layout=layout)
      fig.show()
  </code></pre>
  
  <p>and the result is </p>
  
  <p><a href="https://i.stack.imgur.com/ow411.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ow411.png" alt="enter image description here"></a></p>
  
  <p>How can I show the number inside corresponding cell instead of hovering, like this<a href="https://i.stack.imgur.com/g7s9f.png" rel="noreferrer"><img src="https://i.stack.imgur.com/g7s9f.png" alt="enter image description here"></a></p>