import random import matplotlib.pyplot as plt import numpy as np """ Your plot will look different since the data you're generating is random. However, not all of these points are likely to be close to the reality that the commuter observed from the data she gathered and analyzed. You can plot the distribution she obtained from the data with the simulated bus arrivals: """ mean = 15, 45 sd = 5, 7 x = np.linspace(0, 59, 60) first_distribution = np.exp(-0.5 * ((x - mean[0]) / sd[0]) ** 2) second_distribution = 0.9 * np.exp(-0.5 * ((x - mean[1]) / sd[1]) ** 2) y = first_distribution + second_distribution y = y / max(y) n_buses = 40 bus_times = np.asarray([random.randint(0, 59) for _ in range(n_buses)]) bus_likelihood = np.asarray([random.random() for _ in range(n_buses)]) plt.scatter(x=bus_times, y=bus_likelihood) plt.plot(x, y) plt.title("Randomly chosen bus arrival times and relative probabilities") plt.ylabel("Relative probability of bus arrivals") plt.xlabel("Minutes past the hour") plt.show()