GetDist : How to make appear mean and standard deviation above subplots

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

GetDist : How to make appear mean and standard deviation above subplots

Post by Fabien Dournac » April 09 2020

Hello,

I am using GetDist tool to plot joint distribution and I have found on plot gallery ( https://getdist.readthedocs.io/en/latest/plot_gallery.html [In [17] ) :

Code: Select all

# Customized triangle plot
g = plots.get_subplot_plotter()
g.settings.figure_legend_frame = False
g.settings.alpha_filled_add=0.4
g.settings.title_limit_fontsize = 14
g.triangle_plot([samples, samples2], ['x0', 'x1', 'x2'], 
    filled=True, 
    legend_labels=['Simulation', 'Simulation 2'], 
    legend_loc='upper right', 
    line_args=[{'ls':'--', 'color':'green'},
               {'lw':2, 'color':'darkblue'}], 
    contour_colors=['green','darkblue'],
    title_limit=1, # first title limit (for 1D plots) is 68% by default
    markers={'x2':0})
and the associated plot :

Image

As you can see, means and standard deviations are noted above each diagonal subplot and I don't know how to make them appear. I took the same snippet code and I can't reproduce this display of values.

If someone could tell the Python command line to apply in order to show these values ...

Regards

Fabien Dournac
Posts: 20
Joined: March 27 2010
Affiliation: CERFACS
Contact:

Re: GetDist : How to make appear mean and standard deviation above subplots

Post by Fabien Dournac » April 09 2020

maybe a clue :

if I add :

Code: Select all

title_limit=1
to the

Code: Select all

g.triangle_plot
this way :

Code: Select all

g.triangle_plot([matrix1, matrix2],
                names,
                filled=True,
                legend_labels=['Sum GCs + GCp + WL', 'GCs + (GCp + WL + XC)'],
                legend_loc='upper right',
                contour_colors=['green','darkblue'],
                title_limit=1
                )
I get the following error :

Code: Select all

GetDist Version: 1.0.4, Matplotlib version: 2.2.4
Traceback (most recent call last):
  File "example_dev_LAST.py", line 42, in <module>
    title_limit=1
  File "/Users/other/Library/Python/2.7/lib/python/site-packages/GetDist-1.0.4-py2.7.egg/getdist/plots.py", line 2387, in triangle_plot
    lims=param_limits.get(param.name), ax=ax, _ret_range=True, **diag1d_kwargs)
  File "/Users/other/Library/Python/2.7/lib/python/site-packages/GetDist-1.0.4-py2.7.egg/getdist/plots.py", line 1553, in plot_1d
    ax=ax, **line_args[i])
  File "/Users/other/Library/Python/2.7/lib/python/site-packages/GetDist-1.0.4-py2.7.egg/getdist/plots.py", line 964, in add_1d
    raise ValueError('title_limit not currently supported for MixtureND')
ValueError: title_limit not currently supported for MixtureND
Does this error come from that I am using

Code: Select all

MixtureND
and not

Code: Select all

add_1d
plot ?

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: GetDist : How to make appear mean and standard deviation above subplots

Post by Antony Lewis » April 10 2020

The error message is correct - this option is not currently supported for plotting Gaussian mixture models (rather than samples). Pull requests are always welcome if you want to add the support.

Fabien Dournac
Posts: 20
Joined: March 27 2010
Affiliation: CERFACS
Contact:

Re: GetDist : How to make appear mean and standard deviation above subplots

Post by Fabien Dournac » April 10 2020

Thanks Antony,

I would be glad to add the support, could you indicate me please the source file or the part to modify ?

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: GetDist : How to make appear mean and standard deviation above subplots

Post by Antony Lewis » April 10 2020

You'd have to calculate them using the Gaussian mixture classes, but not entirely trivial because they allow for hard prior bounds in each dimension and hence not just trivial Gaussian integrals (marginalized truncated Gaussian is not a Gaussian).

Post Reply