Skip to content

Commit

Permalink
add CDF to hist
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunyez authored and nocturnalastro committed Oct 9, 2023
1 parent ed72d46 commit 8e05c53
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/vse_sync_pp/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _plot_scatter(self, ax):
def _plot_hist(self, ax):
counts, bins = np.histogram(
np.array(self._y_data, dtype=float),
bins='scott',
bins='fd'
)
ax.hist(bins[:-1], bins, weights=counts)
self._set_yscale(ax)
Expand All @@ -66,8 +66,11 @@ def plot(self, filename):
fig.set_size_inches(10, 8)
self._plot_scatter(ax1)
self._plot_hist(ax2)
ax3 = ax2.twinx()
ax3.set_ylabel('CDF')
ax3.ecdf(self._y_data, color="black", linewidth=2)
plt.savefig(filename)
return fig, (ax1, ax2)
return fig, (ax1, ax2, ax3)

def plot_scatter(self, filename):
fig, ax = plt.subplots(1, constrained_layout=True)
Expand Down

0 comments on commit 8e05c53

Please sign in to comment.