GetDist: plots with logarithmic binning?

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Fabrizio Rompineve
Posts: 2
Joined: February 09 2022
Affiliation: CERN

GetDist: plots with logarithmic binning?

Post by Fabrizio Rompineve » February 09 2022

Hi everyone,

I am trying to plot some MC samples with GetDist and I was wondering if anybody here could kindly suggest how to overcome a binning problem.

My samples are in the form (log10_x, log10_y). I would like to produce plots (with 1 and 2 sigma contours) in terms of (x, y). My strategy was to first transform the samples (log10_x, log10_y) -> (x, y), then feed those to MCSamples() and use log scales for the axis with get_axes. However, this is not enough, as I would also need to set the binning in the plots to, for instance for a 2D plot:

b = [np.logspace(np.log10(xmin),np.log10(xmax), 50), np.logspace(np.log10(ymin),np.log10(ymax), 50)]

In matplotlib one can do: plt.hist2d(x,y, bins=b), but I cannot figure out how to set this in GetDist. Any suggestion?

Thanks!

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

Re: GetDist: plots with logarithmic binning?

Post by Antony Lewis » February 10 2022

I normally just plot the log (e.g. log A_s in the Planck results).

You could plot as normal for log10_x, log10_y and then manually change the axis and tick labels using standard matplotlib.

But you are welcome to make a pull request supporting log mapping internally. But you can't transform to x, y - then the sampling density would be too variable for the plot to work well because the binning internally is regular linear so it can use FFTs.

Fabrizio Rompineve
Posts: 2
Joined: February 09 2022
Affiliation: CERN

Re: GetDist: plots with logarithmic binning?

Post by Fabrizio Rompineve » February 11 2022

Ok, thank you for the reply!
Best

Post Reply