Commit 9c845981 authored by Matthieu Tristram's avatar Matthieu Tristram
Browse files

Add multiple chains

parent 01685750
......@@ -448,7 +448,7 @@ def posterior1d( chains, params, nbin=50, smooth=1,
# ax.legend(names, loc='upper right')
def posterior2d( chain, par1, par2, *args, **kwargs):
def posterior2d( chains, par1, par2, *args, **kwargs):
"""
Plot a 2-D histogram of samples.
......@@ -675,10 +675,7 @@ def triangle( chains, params, nbin=50, parnames=None, names=[], colors=[], lines
def rectangle( chains, par0, params, nbin=50, parnames=None, names=[], colors=[], linestyles=[], smooth=1., fontsize=12,
contour=True, fill=False, cmaps=[], Norm=True, weights=None, ylim=None):
import matplotlib.ticker as mtick
fig=plt.figure()
plt.subplots_adjust(hspace=0.001,wspace=0.001)
import matplotlib.ticker as mtick
#force tuple
if not( isinstance(chains, list) or isinstance(chains, tuple)):
......@@ -687,6 +684,9 @@ def rectangle( chains, par0, params, nbin=50, parnames=None, names=[], colors=[]
nchain = len(chains)
npar = len(params)
fig=plt.figure( figsize=(5*npar,5))
plt.subplots_adjust(hspace=0.001,wspace=0.001)
if len(colors) < nchain:
colors = plt.rcParams['axes.color_cycle']
......@@ -751,11 +751,9 @@ def rectangle( chains, par0, params, nbin=50, parnames=None, names=[], colors=[]
# ax.xaxis.set_major_formatter(mtick.FormatStrFormatter('%.0e'))
#write legend
## if len(names) == nchain:
## ax=plt.subplot( npar, npar, int(0.25*npar)*npar+0.85*npar-1)
## for c in range(nchain):
## plt.text(0.5,1.-0.2*(c+1), names[c], color=colors[c])
## ax.axis('off')
if len(names) == nchain:
for c in range(nchain):
ax.text( 0.9, 1.-0.1*(c+1), names[c], color=colors[c], transform=ax.transAxes, horizontalalignment='right')
return(fig)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment