<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import matplotlib.pyplot as plt


# Sampled earthquake magnitudes from actual data stream
 
magnitudes = [
          1.98, 1.8, 1.8, 1.7, 3.1, 2.0, 1.8, 0.6, 2.8, 0.5,
          2.51, 3.51, 1.4, 2.6, 2.5, 2.4, 2.9, 2.6, 2.8, 2.5,
          1.5, 0.9, 0.9, 1.3, 1.0, 1.7, 0.62, 1.9, 1.2, 0.6,
          0.13, 0.5, 1.1, 0.7, 1.4, 3.1, 3.9, 1.3, 1.06, 3.4,
          4.7, 4.7, 1.04, 0.5, 1.1, 4.5, 4.8, 1.1, 0.4, 0.5,
          1.3, 1.5, 2.7, 1.8, 1.6, 1.8, 4.4, 1.6, 1.4, 0.7,
          1.6, 1.4, 2.0, 2.7, 6.6, 1.4, 0.7, 1.5, 1.18, 4.4,
          1.1, 0.9, 1.6, 1.1, 1.8, 1.2, 0.46, 0.8, 0.6, 2.2,
          0.99, 1.4, 1.4, 1.01, 1.0, 1.3, 1.3, 2.1, 2.92, 3.3,
          0.32, 0.15, 1.32, 1.0, 0.89, 1.3, 2.4, 0.9, 1.1, 1.0,
          1.0, 2.8, 1.1, 1.8, 0.33, 1.3, 3.06, 1.31, 4.8, 0.8,
          1.5, 1.9, 0.47, 0.9, 0.48, 1.2, 0.99, 0.9, 0.6, 1.78,
          0.65, 1.5, 3.2, 0.5, 0.8, 0.4, 1.6, 1.5, 1.5, 2.11,
          3.5, 1.27, 1.7, 1.3, 1.9, 1.1, 0.51, 2.9, 1.6, 0.16,
          0.5, 0.23, 0.4, 0.36, 1.39, 1.9, 2.1, 1.3, 0.6, 1.22,
          1.0, 1.0, 1.89, 0.67, 2.5, 3.1, 1.3, 0.2, 1.7, 1.5]

# Compute average magnitude
avMagnitude = sum(magnitudes)/len(magnitudes)
    
# Plot histogram of magnitudes
plt.plot(magnitudes)

# Add line for average magnitude: a line from (0,avMagnitude)
#                                       to (len(magnitudes), avMagnitude)
plt.plot([0, len(magnitudes)] , [avMagnitude, avMagnitude])

# Label Axes and figure
plt.xlabel('Time')
plt.ylabel('Magnitude')
plt.title('History of Magnitudes')

# Display histogram
plt.show()

# Clear before the next graph
plt.clf()

</pre></body></html>