Extracting contours from GetDist

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
Esteban Chalbaud
Posts: 11
Joined: June 01 2019
Affiliation: Master's student
Contact:

Extracting contours from GetDist

Post by Esteban Chalbaud » July 28 2020

Hello,

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")
ax.set_longitude_grid(45)
ax.set_latitude_grid(45)
ax.set_longitude_grid_ends(90)
g.plot_2d(samples, names[1],names[2]);
plt.grid(True)

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

Post Reply