{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial 3: Plot clusters\n", "\n", "This tutorial will talk about how to plot the clusters created from the data in Tutorial 1.\n", "\n", "**NOTE FOR CONTRIBUTORS: Always clear all output before committing (``Cell`` > ``All Output`` > ``Clear``)**!" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Magic\n", "%matplotlib inline\n", "# Reload modules whenever they change\n", "%load_ext autoreload\n", "%autoreload 2\n", "\n", "# Make clusterking package available even without installation\n", "import sys\n", "sys.path = [\"../../\"] + sys.path" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import clusterking as ck" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As in tutorial 3 we load the data created in tutorial 1:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "d = ck.Data(\"output/tutorial_basics.sql\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "d.configure_variable(\"CVL_bctaunutau\", r\"$C_{V_L}$\")\n", "d.configure_variable(\"CSL_bctaunutau\", r\"$C_{S_L}$\")\n", "d.configure_variable(\"CT_bctaunutau\", r\"$C_T$\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3D plots" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Scatter plot: The list is the list of the columns on the axes. \n", "Changing the order of the columns will turn around the cube. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "d.plot_clusters_scatter(['CVL_bctaunutau', 'CSL_bctaunutau', 'CT_bctaunutau']);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If it is still not easy to get an overview, use the ``clusters`` argument to limit ourselves to certain clusters." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "d.plot_clusters_scatter(['CVL_bctaunutau', 'CSL_bctaunutau', 'CT_bctaunutau'], clusters=[1, 2, 3]);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If only two columns are given, several cuts will be presented (up to 16 by default):" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2D cuts" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that the benchmark points are denoted by a larger symbol." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "d.plot_clusters_scatter(['CVL_bctaunutau', 'CSL_bctaunutau']);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Again, we can also limit ourselves on the clusters that we want to display:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "d.plot_clusters_scatter(['CVL_bctaunutau', 'CSL_bctaunutau'], clusters=[1,2]);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can also fill the space between sample points:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "d.plot_clusters_fill(['CVL_bctaunutau', 'CSL_bctaunutau']);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### More configuration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Several options to configure the ClusterPlot object can be changed after the object has been initialized." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The number of plots for the 'slices' can be selected as follows:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "d.plot_clusters_fill(['CVL_bctaunutau', 'CSL_bctaunutau'], max_subplots=3);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "help(d.plot_clusters_scatter)" ] } ], "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.5.2" } }, "nbformat": 4, "nbformat_minor": 1 }