Skip to content

Commit

Permalink
Merge dd6ace0 into 284cead
Browse files Browse the repository at this point in the history
  • Loading branch information
zblz committed Nov 27, 2018
2 parents 284cead + dd6ace0 commit 2affe8b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions naima/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1417,18 +1417,20 @@ def plot_distribution(samples, label, figure=None):

histnbins = min(max(25, int(len(samples) / 100.0)), 100)
xlabel = "" if label is None else label

if isinstance(samples, u.Quantity):
samples_nounit = samples.value
else:
samples_nounit = samples

n, x, _ = ax.hist(
samples,
samples_nounit,
histnbins,
histtype="stepfilled",
color=color_cycle[0],
lw=0,
density=True,
)
if isinstance(samples, u.Quantity):
samples_nounit = samples.value
else:
samples_nounit = samples

kde = stats.kde.gaussian_kde(samples_nounit)
ax.plot(x, kde(x), color="k", label="KDE")
Expand Down

0 comments on commit 2affe8b

Please sign in to comment.