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.
This exercise is part of the course
Introduction to Data Visualization with Plotly in Python
Exercise instructions
- Create a scatterplot for the
penguins
data. - Set the scatterplot to compare features
Culmen Length (mm)
on the x-axis andCulmen Depth (mm)
on the y-axis.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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()