Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting the earthquake dataset #15

Open
ageorgou opened this issue Oct 27, 2021 · 0 comments
Open

Plotting the earthquake dataset #15

ageorgou opened this issue Oct 27, 2021 · 0 comments
Labels
week4 Working with data

Comments

@ageorgou
Copy link

ageorgou commented Oct 27, 2021

Your goal is to analyse the same earthquake data as before (#13) and produce two plots, showing:

  • the frequency (number) of earthquakes per year
  • the average magnitude of earthquakes per year

To help you off, we have suggested an outline of the code. You can change this as you want, or use your own structure.

  1. Choose someone to share their screen and type. The other team members will tell them what to write.
    • Make sure that person has forked the earthquakes repository and cloned their fork locally. They should also give access to the rest of the members.
    • Make a new branch with your combined GitHub usernames, named plots-@username1-@username2-...
  2. If you are not sure you have read the data correctly, you may want to look at the sample solution. You can start from that or from one of your own answers.
  3. Take a few minutes to look at the outline given, and think about how you will structure your code. What steps do you need and how will they connect? Do you want to change the provided functions or add some more?
  4. Write some code to produce one plot.
  5. When you are finished (or have done as much as you can), push your code, and open a Pull Request to the original earthquakes repository. Include the text Answers UCL-MPHY0021-21-22/RSE-Classwork#15 in the description to link it to this issue. Add one or both plots if you want!
  6. If you have time, continue with the other plot and add it to the PR!

Some hints:

  • You can do the computations required in "plain" Python, but think about using the numpy library (the unique function or others could be helpful, depending on how you have approached the problem)
  • For plotting:
    • Make sure you have computed the values you need to plot!
    • Choose an appropriate plot type (if you need inspiration, there are various galleries) and then see how to create that in matplotlib.
    • See whether you need to put your data in a particular form to create the plot.
    • After plotting, do you need to make any visual adjustments? (on, for example, the axes, labels, colours...)
    • Save your plots to a file and check the result.

Sample solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
week4 Working with data
Projects
None yet
Development

No branches or pull requests

1 participant