Different requests about GetDist

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
Fabien Dournac
Posts: 6
Joined: March 27 2010
Affiliation: CERFACS

Different requests about GetDist

Post by Fabien Dournac » April 13 2020


I would like to know and apply different options with the tool "GetDist"

1) First, I would like to put the legend manually on (x,y) coordinates on the figure "triangle_plot"

I give you an example of code snippet abou this request :

Code: Select all

#  Example of pre-defined location for legend

# Mean of each cosmo parameters : respect order of generated "Big" Fisher matrix
mean = [0.32, 0.05, -1.0, 0.0, 0.96, 0.67, 0.815]
# Names and labels
names = ['Omega_m', 'Omega_b', 'w_0', 'w_a', 'h', 'n_s', 'sigma_8']
labels = [r'\Omega_{m}', r'\Omega_{b}', r'w_{0}', r'w_{a}', r'h', r'n_{s}', r'\sigma_{8}']
matrix1 = GaussianND(mean, COV_Fish_GCs_GCp_WL, labels = labels, names = names)
matrix2 = GaussianND(mean, COV_Fish_GCs_GCp_WL_XC, labels = labels, names = names)
# Plot triplot
plt.rcParams['text.usetex'] = True
plt.rc_context({'axes.autolimit_mode': 'round_numbers'})
g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = True
g.settings.legend_fontsize = 24
g.settings.axes_labelsize = 24
g.settings.axes_fontsize  = 14
g.settings.alpha_filled_add = 0.9
g.settings.title_limit_fontsize = 18
#g.settings.plot_meanlikes = True
g.triangle_plot([matrix1, matrix2],
                filled = True,
                legend_labels = ['Sum GCs + GCp + WL', 'GCs + (GCp + WL + XC)'],
                #legend_loc = 'upper right',
                contour_colors = ['green','darkblue'],
As you can see above, I commented the line
#legend_loc = 'upper right'
: Can I put the legend manually by specifying the (y,x) coordinates ? If this is possible, could you tell me how to achieve it ?

2) Secondly, I would like to make display on (x,y) axis (xtick/ytick) labels for each sub-plot the value of the "center" of parameter that I plot (I think I can say this center corresponds to the mean of concerned parameter).

Here below an example which illustrates the strange behavior : for all parameters of the triplot except for "h", "n_s" and "sigma8", this center value is well displayed. For "h", "n_s" and "sigma_8", the ticks are plotted such a way that we don't have a center value (maybe I have to increase the number of ticks, I don't know ...) :


3) Moreover, you can see also that on horizontal axis (x), the labels of paramters are not all aligned, depending of the number of decimals with the rotated value of ticks labels values.

How can I fix this and make all the latex symbol aligned (the issue only occurs on horizontal), i.e at the same height regards to the (Ox) axis.

For example, can I force the same number fixed of decimals for all parameters ticks values ?

4) You will remark that "minus" sign is too long : I suspect it is responsible of bad alignement of [math] parameter compared to all other ones. I wonder how to render, in Latex integrated into GetDist, a "minus" sign with a length less large.

This equest 4) is also connected to the previous request 3) above but in request 3), there is also the varying number of decimals which is involved.

5) Finally, I have a last question : each sub-plot has a nice rendering but I would like to zoom each joint distribution in order to avoid, as much as possible, empty space around the contours : is it possible to apply a scale factor for each subplot to fill almost the 2D contours (for example, width and height of contours would fill 90% or 80% of the width/height of the sub-plot) ??

Sorry if my post is a little long, I don't want to be boring but I would really appreciate if some of you could give answers or partially answers

Kind regards

Post Reply