In this Plotly tutorial, you will learn how to plot a treemap chart in Python. You can use px.treemap()
function to plot a treemap chart.
# Import Plotly Module import plotly.express as px # Import Dataset dataset = px.data.gapminder().query("continent=='Oceania'") # Treemap Chart plot = px.treemap(dataset, path=['country', 'year'], values='pop') # Show the Plot plot.show()
Output:
