{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# ArviZ support\n", "\n", "As of version 2.2, corner supports plotting [ArviZ](https://arviz-devs.github.io/arviz/) samples, providing a consistent interface to [many MCMC samplers](https://arviz-devs.github.io/arviz/getting_started/CreatingInferenceData.html).\n", "\n", "Here is a simple example of this:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [] }, "outputs": [], "source": [ "import corner\n", "import numpy as np\n", "import arviz as az\n", "\n", "np.random.seed(11234)\n", "\n", "x = np.random.randn(2, 2000)\n", "data = az.from_dict(\n", " posterior={\"x\": x, \"y\": np.random.randn(2, 2000, 2)},\n", " sample_stats={\"diverging\": x < -1.2},\n", ")\n", "\n", "figure = corner.corner(data, divergences=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "When using this interface, it is probably best to provide the `truths` parameter using a dictionary keyed on the variable names:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "figure = corner.corner(data, truths={\"x\": 1.5, \"y\": [-0.3, 0.1]})" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.1" } }, "nbformat": 4, "nbformat_minor": 4 }