BaşlayınÜcretsiz Başlayın

Enhancing our GDP plot

The United Nations loved your previous plot—the legend really stands out and makes the plot easier to understand.

However, some interesting data points are not easy to further analyze due to the limited information in the plot.

Your task is to enhance the plot of life_gdp created in the last exercise to include more information in the hover and style it as requested.

Some of the code will be familiar from earlier in the chapter.

Bu egzersiz

Introduction to Data Visualization with Plotly in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a scatterplot using the life_gdp DataFrame, setting the x-axis to be Life expectancy, the y-axis to be GDP Per Capita.
  • Add the columns Continent, Life expectancy, and GDP Per Capita to appear in the hover information.
  • Set the Country variable to be bold at the top of the hover information.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create the scatterplot
fig = px.scatter(
  data_frame=____, 
  x="____", 
  y="____",
  color="Continent",
  # Add columns to the hover information
  ____=["Continent", "Life expectancy", "GDP Per Capita"],
  # Add a bold variable in hover information
  ____="Country"
)

# Show the plot
fig.show()
Kodu Düzenle ve Çalıştır