[GetDist] Legend for roots that aren't on all plots

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Luke Hart
Posts: 70
Joined: July 13 2015
Affiliation: University of Manchester

[GetDist] Legend for roots that aren't on all plots

I have a situation where I'm making a triangle plot where the roots (let's say x1,x2,x3,x4) are plotted but then they have a hierarchy of added parameters (i.e. x1 has p1, x2 has p1 and p2 varying, x3 has p1,p2 and p3 varying...)

GetDist ignores the first root because obviously you cannot see p1 vs. p2 covariance (since the root x1 doesn't have p1 varying). How do you adjust the legend so it shows all the roots and not just the last 3??

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

Re: [GetDist] Legend for roots that aren't on all plots

Try starting with the root that has the most varying parameters.

Luke Hart
Posts: 70
Joined: July 13 2015
Affiliation: University of Manchester

Re: [GetDist] Legend for roots that aren't on all plots

I already do, otherwise GetDist just doesn't work. It doesn't plot p2 or p1 unless the chains with p3,p2,p1 are all included first. But because p1 is only shown on the 1D distributions, it just won't show a label for the first parameter (The legend handles are clearly patches off the area of the contours rather than lines like standard matplotlib)

Luke Hart
Posts: 70
Joined: July 13 2015
Affiliation: University of Manchester

Re: [GetDist] Legend for roots that aren't on all plots

I tried putting in a legend by hand (using ax and handles) but when I targeted the 1D plot for handles, it just didn't print a legend. I'm assuming the top of the triplot is the triangleObject.subplots[0][0] ?

Luke Hart
Posts: 70
Joined: July 13 2015
Affiliation: University of Manchester

Re: [GetDist] Legend for roots that aren't on all plots

Update:

Fixed it, you can target the figure in the GetDistPlotter object and do the following (if anyone is interested):

Code: Select all

gPlotObj.fig.legend(gPlotObj.subplots[0][0].lines,lineLabels)
It's a bit more hardwired and it targets the lines as handles instead of Rectangle patches, but it looks good :)

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

Re: [GetDist] Legend for roots that aren't on all plots

I'm not sure there's a built-in solution for that, you may need to add the legend manually.