15. Warm-up: Scatter plots in Python

Last updated almost 3 years ago
3 questions

Go to Replit.com

If this is the first time you use Replit, click on the link below for instructions as to how to get started:
Getting started with Replit.
1

Use the data below to create two lists in Python: one called gun_ownership, and the other called homicide_rate.




Print your lists to check that they have been created properly. Add an image of your output.

1

Now you will create a scatter plot in Python. First you need to import the library matlpotlib and from it pyplot. Then you need to add the instructions for creating the scatter plot. The code is shown in the image below.


  • Add an image of your scatter plot in the space below.
  • Discuss whether there is any correlation between a country's handgun ownership and homicide rate.
  • Do you think there is a causal relation between gun ownership and homicide rate? In other words, does one variable cause the other? Explain.

Remember that correlations can be positive, negative or nonexistent. Here is some vocabulary to use in your explanation.


Source: https://byjus.com/maths/correlation/

1

Bonus instructions!

Enhance your scatter plot by labeling the x- and y-axes by adding two lines to your code:


Add an image of your new scatter plot.