LoslegenKostenlos loslegen

EDA: Plotting earthquakes over time

Make a plot where the y-axis is the magnitude and the x-axis is the time of all earthquakes in Oklahoma between 1980 and the first half of 2017. Each dot in the plot represents a single earthquake. The time of the earthquakes, as decimal years, is stored in the NumPy array time, and the magnitudes in the NumPy array mags.

Diese Übung ist Teil des Kurses

Case Studies in Statistical Thinking

Kurs anzeigen

Anleitung zur Übung

  • Plot the magnitude (mags) versus time (time) using plt.plot() with keyword arguments marker='.' and linestyle='none'. Also use the keyword argument alpha=0.1 to make the points transparent to better visualize overlapping points.
  • Label the x-axis 'time (year)', y-axis 'magnitude', and show the plot.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Plot time vs. magnitude


# Label axes and show the plot



Code bearbeiten und ausführen