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
.
This exercise is part of the course
Introduction to Data Science in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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()