MulaiMulai sekarang secara gratis

Building a scatterplot with specific colors

In your work as a data analyst, you have been engaged by a group of Antarctic research scientists to help them explore and report on their work.

They have spent much time collating data on penguin species but are having difficulty visualizing it to understand what is happening. Specifically, they asked if you could help them plot their data about statistics on the penguins' body attributes. They also suspect there is some pattern related to species but are unsure how to plot this extra element.

In this exercise, you will help the scientific team by creating a scatterplot of the "Culmen" (upper beak) attributes of the scientists' penguin data, ensuring that the species are included as specific colors.

You have been provided a penguins DataFrame.

Latihan ini adalah bagian dari kursus

Introduction to Data Visualization with Plotly in Python

Lihat Kursus

Petunjuk latihan

  • Create a scatterplot for the penguins data.
  • Set the scatterplot to compare features Culmen Length (mm) on the x-axis and Culmen Depth (mm) on the y-axis.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Create a scatterplot
fig = px.____(data_frame=____, title="Penguin Culmen Statistics",
    # Set the right columns
    x="____",
    y="____",
    # We will set some colors
    color="Species",
    color_discrete_map=color_map
)

# Show your work
fig.show()
Edit dan Jalankan Kode