Page 1 of 1

Plot only 1 sigma or 2 sigma contours

Posted: August 01 2020
by Dournac Fabien

In a context of covariane matrix with Fisher's formism, I would like to plot, with triangle_plot function only 1 sigma contour or 2 sigma contours, not the both in the same time.

Here is below my current code snippet that plots 1 and 2 sigma at the same time of 2 covariance matrixes (matrix1 and matrix 2) :

Code: Select all

# Call triplot
g.triangle_plot([matrix1, matrix2],
                filled = True,
                legend_labels = ['1240', '1565'],
                legend_loc = 'upper right',
                contour_colors = ['red','darkblue'],
                line_args = [{'lw':2, 'color':'red'},
                {'lw':2, 'color':'darkblue'}],
I saw during my researches a paramater called contour_levels for example in the function add_2d_contours but I don't know how to use it
in triangle_plot for plotting only 1 or 2 sigma contours.

If anyone could help, this would be fine.

Re: Plot only 1 sigma or 2 sigma contours

Posted: August 03 2020
by Antony Lewis
You can set "contours" in analysis settings to determine which contours are calculated (and then numbered 0, 1,2.. in getdist plotting):

"num_plot_contours" in the plot settings determines which are actually plotted

Re: Plot only 1 sigma or 2 sigma contours

Posted: August 04 2020
by Dournac Fabien
As usually, thanks Antony.

Step by step, all the answers I got help me a lot to produce almost the rendering I want.

Below a figure of what I get for the moment :


Remains now 2 issues to solve :

1) keep an equi-distant space between each subplot (box) : that's not the case as you can see it in above figure and I don't know which parameter I have to modify or to assign that controls the space between each subplot.

I tried to manually set a space character :

Code: Select all

      spacex = '  '
      spacey = '  '
      ax.set_ylabel(spacey, rotation=0, fontsize=20, labelpad=15)
      ax.set_xlabel(spacex, rotation=0, fontsize=20, labelpad=15)
But unfortulately, this doesn't work. Have you got another idea ?

2) Find a way to set the priority of 2 sigma red filled (red = Lower Figure of Merit = FoM) zone on 1 sigma blue shaded filled (blue = Higher Figure of Merit = FoM) zone in the following figure :


This issue 2) makes reference to the following post : [url]viewtopic.php?t=3374[url]

Indeed, I would like to have the same behabior than this other image got by another team (don't take into account of yellow contours).


You can see that 2 sigma blue filled zone (Lower FoM) is over the 1 sigma red filled zone (Higher FoM), and so not shaded like in my current situation.

Anyone help about theses 2 issues would be fine.