This tutorial will talk about how to visualise the distributions that have been built in Tutorial 1.
NOTE FOR CONTRIBUTORS: Always clear all output before committing (Cell
> All Output
> Clear
)!
# Magic
%matplotlib inline
# Reload modules whenever they change
%load_ext autoreload
%autoreload 2
# Make clusterking package available even without installation
import sys
sys.path = ["../../"] + sys.path
import clusterking as ck
First we load the data created in Tutorial 1 in the folder output/cluster/ with the name tutorial_basics and pass it to the Data class.
d = ck.Data("output/tutorial_basics.sql")
The possible columns to be plotted can be found using:
d.par_cols
Let's also improve the styling of the variable on the x axis:
d.configure_variable("q2", axis_label=r"$q^2\ [\mathrm{GeV}^2]$")
We are now ready to visualise our created data: Let's start by drawing the histograms corresponding to the benchmark points of each clusters by typing:
d.plot_dist();
We can also add more sample points to the plot (in addition to the benchmark point):
d.plot_dist(clusters=[1, 2], nlines=5);
Save plots using the usual matplotlib syntax, e.g.
fig = d.plot_dist();
fig.savefig("output/plots/test.pdf")
Showing the minima and maxima of all clusters is achieved with the plot_minmax method.
d.plot_dist_minmax();
The same plot for clusters 2 and 3 only:
d.plot_dist_minmax(clusters=[2,3]);
Box plots can be produced using the box_plot method:
d.plot_dist_box();
Showing clusters 0 and 2 only:
d.plot_dist_box(clusters=[0, 2]);