cristobal-sifon / plottery

Plotting tools
GNU General Public License v3.0
0 stars 0 forks source link

new corner plots implementation #11

Open cristobal-sifon opened 6 years ago

cristobal-sifon commented 6 years ago

The corner plot can be handled much more easily (especially with multiple chains) if I split it into the following:

With this structure, adding chains or changing styles per chain and per-parameter should be straightforward.

cristobal-sifon commented 6 years ago

Perhaps the Figure class, or a different class (Parameters?) should contain parameter details such as name, column within the plot, possibly binning and plotting styles, etc.

cristobal-sifon commented 6 years ago

here's a first pass at how this might be used:

# 2 chains, 5 parameters per chain, all normally-distributed around zero with std=1
mcmc_output = np.random.normal(size=(2,5,10000))
# initialize the base MCMC chain first (e.g., the fiducial model)
chains = Chain(mcmc_output[0], names=names, chain_label='Model 1')
# initialize the figure with the appropriate number of axes and so on
fig = Figure(Chain)
# or possibly just skip these two with:
fig, chain = Figure(mcmc_output[0], names=names)

If mcmc_output[i] includes column names (e.g. an astropy or FITS table), then (i) there should be no need to specify names, and (ii) one could have the option to specify an include_names kwarg. It can then get more exciting once we are able to start doing things like

fig.add_chain(mcmc_output[1], names=names[:3])

which should mean that we only plot the first three parameters of the second chain, and leave the other axes unchanged.

Perhaps columns/rows could be accessed as

fig.axes[param1].set_xlabel(...)

etc. or perhaps something like the following makes more sense:

fig.chain[param].label = name

After each of these changes one should be able to call something like

fig.draw()