Skip to content

Commit

Permalink
mark and print best fit point in 2d plot
Browse files Browse the repository at this point in the history
  • Loading branch information
Ikaroshu committed Jun 11, 2019
1 parent e963906 commit c05ba95
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyCEvNS/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def credible_1d(self, idx: int, credible_level=(0.6827, 0.9545), nbins=80, ax=No
return fig, ax

def credible_2d(self, idx: tuple, credible_level=(0.6827, 0.9545), nbins=80, ax=None,
center=None, heat=False, xlim=None, ylim=None):
center=None, heat=False, xlim=None, ylim=None, mark_best=False):
"""
plot the correlation between parameters
:param idx: the index of the two parameters to be ploted
Expand Down Expand Up @@ -125,6 +125,9 @@ def credible_2d(self, idx: tuple, credible_level=(0.6827, 0.9545), nbins=80, ax=
else:
zv[posy-1, posx-1] += self.ftxt[i, 0]
sorted_idx = np.unravel_index(np.argsort(zv, axis=None)[::-1], zv.shape)
if mark_best:
print(xv[sorted_idx[0][0], sorted_idx[1][0]], yv[sorted_idx[0][0], sorted_idx[1][0]])
ax.plot([xv[sorted_idx[0][0], sorted_idx[1][0]]], [yv[sorted_idx[0][0], sorted_idx[1][0]]], '*')
if heat:
im = ax.pcolormesh(xv, yv, zv/(binxw*binyw), cmap='rainbow', edgecolors='face')
if xlim is not None:
Expand Down

0 comments on commit c05ba95

Please sign in to comment.