LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Introduction to Data Visualization with Plotly in Python

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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()
Code bearbeiten und ausführen