I have a covariance matrix deduced Fisher formalism and I need to plot it in a triplot (joint distribution between the 7 cosmological parameters).
By default, the parameters have the names "p1", "p2", "p3", ..., "p7" and I would like to replace them by Latex symbol :
[math]
Here below the script I am using :
Code: Select all
# Show plots inline, and load main getdist plot module and samples class
from __future__ import print_function
import sys, os
sys.path.insert(0,os.path.realpath(os.path.join(os.getcwd(),'..')))
import numpy as np
from getdist import plots
import getdist
import matplotlib.pyplot as plt
print('GetDist Version: %s, Matplotlib version: %s'%(getdist.__version__, plt.matplotlib.__version__))
# The plotting scripts also let you plot Gaussian (or Gaussian mixture) contours
from getdist.gaussian_mixtures import GaussianND
## Load Fisher matrix and invert it to get Covariance array
# Load Fisher matrix
Fish_GCs_GCp_WL = np.loadtxt('Fisher_GCs_GCp_WL')
Fish_GCs_GCp_WL_XC = np.loadtxt('Fisher_GCs_GCp_WL_XC')
# Invert to get Covariance matrix
COV_Fish_GCs_GCp_WL = np.linalg.inv(Fish_GCs_GCp_WL)[0:8,0:8]
COV_Fish_GCs_GCp_WL_XC = np.linalg.inv(Fish_GCs_GCp_WL_XC)[0:8,0:8]
mean = [0.05, 0.67, 0.32, 0.96, 0.68, -1, 0, 0.815]
#names = ['$\Omega_{b}$', '$h$', '$\Omega_{m}$', '$n_{s}$', '$\Omega_{DE}$', '$w_{0}$',\
labels = np.copy(names)
matrix1 = GaussianND(mean, COV_Fish_GCs_GCp_WL)
matrix2 = GaussianND(mean, COV_Fish_GCs_GCp_WL_XC)
g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = True
g.settings.scaling = False
g.settings.alpha_filled_add=0.95
g.settings.title_limit_fontsize = 18
g.settings.legend_fontsize = 18
#names4 = g.settings.param_latex_label(None, names2[0])
plt.rcParams['text.usetex']=True
names = ['p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7']
labels = [r'\Omega_{m}', r'\Omega{b}', r'w_{0}', r'w_{a}$', r'h', r'n_{s}', r'\sigma_{8}']
g.triangle_plot([matrix1, matrix2], labels = labels, names = names, filled = True)
#g.triangle_params =['param1', 'param2', 'param3', 'param4', 'param5',\
# 'param6', 'param7'], labels=[r'\Omega_{m}', r'\Omega{b}', r'w_{0}', \
# r'w_{a}$', r'h', r'n_{s}', r'\sigma_{8}'], label='Model')
#names = [param1, param2, param3, param4, param5,\
# param6, param7]
#labels = [r'\Omega_{m}', r'\Omega{b}', r'w_{0}', \
# r'w_{a}$', r'h', r'n_{s}', r'\sigma_{8}']
g.export('output_example.pdf')