From f121ed97083d4a375cfe3efe3fb0544b7dc73264 Mon Sep 17 00:00:00 2001 From: arm61 Date: Mon, 5 Dec 2022 15:42:15 +0100 Subject: [PATCH] Use distribution in plotting of credible interval --- docs/source/arrhenius_t.ipynb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/source/arrhenius_t.ipynb b/docs/source/arrhenius_t.ipynb index eb0ab18f..00b175e3 100644 --- a/docs/source/arrhenius_t.ipynb +++ b/docs/source/arrhenius_t.ipynb @@ -201,13 +201,20 @@ { "cell_type": "code", "execution_count": null, - "id": "56818592-cdf0-4971-a77d-9b0364f0c214", + "id": "afbbfa87-d83b-4686-bb2f-ae9c692dc7f2", "metadata": {}, "outputs": [], "source": [ - "plt.errorbar(1000/s.x, s.y.n, s.y.ci(), marker='o', ls='', zorder=10)\n", - "for i in np.random.randint(s.activation_energy.size, size=128):\n", - " plt.plot(1000/s.x, s.function(s.x, *s.get_sample(i)), color='k', alpha=0.05)\n", + "credible_intervals = [[16, 84], [2.5, 97.5], [0.15, 99.85]]\n", + "alpha = [0.6, 0.4, 0.2]\n", + "\n", + "plt.errorbar(1000/s.x, s.y.n, s.y.ci(), marker='o', ls='', color='k', zorder=10)\n", + "for i, ci in enumerate(credible_intervals):\n", + " plt.fill_between(1000/s.x,\n", + " *np.percentile(s.distribution, ci, axis=1),\n", + " alpha=alpha[i],\n", + " color='#0173B2',\n", + " lw=0)\n", "plt.yscale('log')\n", "plt.xlabel('$1000T^{-1}$/K$^{-1}$')\n", "plt.ylabel('$D$/cm$^2$s$^{-1}$')\n",