This code produces a corner plot for analytical multi-dimensional Gaussian distribution, using covariance matrix and mean matrix. It also allows us to plot another distribution, with reduced dimensionality, on top. I.e. a distribution for a case where we fixed one variable.
It's as simple as figure_1 = normal_corner.normal_corner(covariance_matrix,mean_vector,variable_labels)
!
See demo.py for detailed usage examples.
Option 1:
pip install normal_corner
Option 2:
python setup.py install
in cloned directory
The main component is a normal_corner function inside a normal_corner package.
def normal_corner(covm,mean,varlabels,fixedvarindex=None,fixedvarvalue=None,
covm2=None,mean2=None,scale_factor=3,diagnostic=False,
color='red',color2='blue', fig=None, **fig_kw):
Below is a description of inputs and outputs.
- Matplotlib figure object with a corner plot
covm
: covariance matrix, numpy array, NxN.mean
: mean matrix, numpy array, 1xN.varlabels
: labels for plotting, 1xN, list of str in LaTex format, between ($$).
fixedvarindex
: index of variable that we do not use (fix), int, starting from 0. If not None, covm2 and mean2 must not be None.fixedvarvalue
: value of fixed variable, float. Leave None not to plot fixed value.newcov
andnewmean
: new covariance and mean matrices, same format, as above.
scale_factor
: scale factor for plotting area, float, in sigma.diagnostic
: an option to print out some diagnostic messages, bool.color
: color for a main Normal distribution, str.color2
: color for a secondary Normal distribution, with reduced dimensionality, str.fig
: Matplotlib figure to plot to, possibly output of corner.corner to plot on top of MCMC corner plot- additional keywords are passed to figure().