
Create a Heatmap with plotly express –
Let’s read a dataset
import pandas as pd
url = "https://raw.githubusercontent.com/bprasad26/lwd/master/data/happiness_2019.csv"
df = pd.read_csv(url)
df = df.loc[:,'Score':'Perceptions of corruption']
df.head()

To create a heatmap in plotly express we use px.imshow() method.
import plotly.express as px
corr_matrix = df.corr()
fig = px.imshow(corr_matrix)
fig.show()

Display Text on Heatmap –
Too display text in heatmap use the text_auto parameter.
corr_matrix = df.corr()
fig = px.imshow(corr_matrix)
fig.show()

Related Posts –
1 . How to install plotly python with pip
2 . How to create a Line Chart with Plotly Python
3 . How to create Scatter plot in Plotly Python
4 . How to create a Bar Chart in Plotly Python
5 . How to create Horizontal Bar Chart in Plotly Python
6 . How to create a Histogram in plotly python
7 . How to Create a Box Plot in Plotly Python
8 . How to create a Pie Chart in Plotly Python
9 . How to create a Dot Plot in Plotly Python