CommencezCommencez gratuitement

Modifying a scatterplot

In the previous exercise, we created a scatter plot to show Freddy Frequentist's cell phone data.

In this exercise, we've done some magic so that the plot will appear over a map of our town. If we just plot the data as we did before, we won't be able to see the map or pick out the areas with the most points. We can fix this by changing the colors, markers, and transparency of the scatter plot.

As before, the matplotlib.pyplot module has been imported under the alias plt, and the cellphone data is in the DataFrame cellphone.

Cette activité fait partie du cours

Introduction to Data Science in Python

Voir le cours

Exercice interactif pratique

Essayez cet exercice en complétant ce code d’exemple.

# Change the marker color to red
plt.scatter(cellphone.x, cellphone.y,
           ____=____)

# Add labels
plt.ylabel('Latitude')
plt.xlabel('Longitude')

# Display the plot
plt.show()
Modifier et exécuter le code