Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Introduction to Data Visualization with Plotly in Python

Cursus bekijken

Oefeninstructies

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

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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 bewerken en uitvoeren