From ad4d93dd6cf32abd4e37e905c5dc0deaa42b735b Mon Sep 17 00:00:00 2001 From: PRKramer <77206177+PRKramer@users.noreply.github.com> Date: Tue, 14 Nov 2023 19:54:40 -0500 Subject: [PATCH] Update SMC-ABC_Lotka-Volterra_example.ipynb Added the time array to the plots to correctly represent the independent variable in 2 plots. --- examples/samplers/SMC-ABC_Lotka-Volterra_example.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/samplers/SMC-ABC_Lotka-Volterra_example.ipynb b/examples/samplers/SMC-ABC_Lotka-Volterra_example.ipynb index ae8513626..cdc1d16c9 100644 --- a/examples/samplers/SMC-ABC_Lotka-Volterra_example.ipynb +++ b/examples/samplers/SMC-ABC_Lotka-Volterra_example.ipynb @@ -456,8 +456,8 @@ "# plotting observed data.\n", "observed = add_noise(a, b)\n", "_, ax = plt.subplots(figsize=(12, 4))\n", - "ax.plot(observed[:, 0], \"x\", label=\"prey\")\n", - "ax.plot(observed[:, 1], \"x\", label=\"predator\")\n", + "ax.plot(t,observed[:, 0], \"x\", label=\"prey\")\n", + "ax.plot(t,observed[:, 1], \"x\", label=\"predator\")\n", "ax.set_xlabel(\"time\")\n", "ax.set_ylabel(\"population\")\n", "ax.set_title(\"Observed data\")\n", @@ -603,8 +603,8 @@ "# plot results\n", "_, ax = plt.subplots(figsize=(14, 6))\n", "posterior = idata_lv.posterior.stack(samples=(\"draw\", \"chain\"))\n", - "ax.plot(observed[:, 0], \"o\", label=\"prey\", c=\"C0\", mec=\"k\")\n", - "ax.plot(observed[:, 1], \"o\", label=\"predator\", c=\"C1\", mec=\"k\")\n", + "ax.plot(t,observed[:, 0], \"o\", label=\"prey\", c=\"C0\", mec=\"k\")\n", + "ax.plot(t,observed[:, 1], \"o\", label=\"predator\", c=\"C1\", mec=\"k\")\n", "ax.plot(competition_model(None, posterior[\"a\"].mean(), posterior[\"b\"].mean()), linewidth=3)\n", "for i in np.random.randint(0, size, 75):\n", " sim = competition_model(None, posterior[\"a\"][i], posterior[\"b\"][i])\n",