Page 1 of 1

Extracting contours from GetDist

Posted: July 28 2020
by Esteban Chalbaud

I am analysing some chains that are basically angles in galactic coordinates. I want to use the kernel density estimator that is inside getdist to plot confidence regions in an sky map. but a doubt raised: Is that possible to plot contour plots specifying matplotlib projections? I mean: extract the contour in an array an plot them inside matplotlib, or set the option inside the subplot funcion projection="mollweide" and let the function plot_2d export the plot? .

I was trying to use the extraction approach, but i got stuck in the format of the contours:
d = samples.get2DDensityGridData( names[1], names[2],num_plot_contours=2, get_density=True, meanlikes=False)
d.getContourLevels(contours=(0.68, 0.95))

I also tried no to do this but plotting a single 2D graph and see if defining matplotlib subplots i can get a mollweide projection
(However, I just got the usual squared plot that plot_2d function gives):

samples = MCSamples(samples=samps,names = names, labels = labels)
plt.figure(figsize=(12, 10))
ax = plt.subplot(projection="mollweide")
g.plot_2d(samples, names[1],names[2]);

Is there any way to plot contour level in sky map projection?. I was able to do it with seaborn Kernel density estimator sns.kdeplot but for consistency i should be able to do the same thing with getdist.

Thanks in advance