{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Getting started\n", "\n", "The only user-facing function in the module is `corner.corner` and, in its simplest form, you use it like this:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import corner\n", "import numpy as np\n", "\n", "ndim, nsamples = 2, 10000\n", "np.random.seed(42)\n", "samples = np.random.randn(ndim * nsamples).reshape([nsamples, ndim])\n", "figure = corner.corner(samples)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The following snippet demonstrates a few more bells and whistles:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Set up the parameters of the problem.\n", "ndim, nsamples = 3, 50000\n", "\n", "# Generate some fake data.\n", "np.random.seed(42)\n", "data1 = np.random.randn(ndim * 4 * nsamples // 5).reshape(\n", " [4 * nsamples // 5, ndim]\n", ")\n", "data2 = 4 * np.random.rand(ndim)[None, :] + np.random.randn(\n", " ndim * nsamples // 5\n", ").reshape([nsamples // 5, ndim])\n", "data = np.vstack([data1, data2])\n", "\n", "# Plot it.\n", "figure = corner.corner(\n", " data,\n", " labels=[\n", " r\"$x$\",\n", " r\"$y$\",\n", " r\"$\\log \\alpha$\",\n", " r\"$\\Gamma \\, [\\mathrm{parsec}]$\",\n", " ],\n", " quantiles=[0.16, 0.5, 0.84],\n", " show_titles=True,\n", " title_kwargs={\"fontsize\": 12},\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The [API documentation](../api.rst) gives more details about all the arguments available for customization." ] } ], "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": "python", "version": "3.9.1" } }, "nbformat": 4, "nbformat_minor": 4 }