Skip to content

Commit

Permalink
Only plot histogram if more than 2 bins
Browse files Browse the repository at this point in the history
  • Loading branch information
mogres committed Jun 22, 2023
1 parent 44071c0 commit 5dd2c92
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cellpack/autopack/Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,8 @@ def histo(self, distances, filename, title_str="", x_label="", y_label=""):
plt.clf()
# calculate histogram
nbins = int(numpy.sqrt(len(distances)))
if nbins < 2:
return
y, bin_edges = numpy.histogram(distances, bins=nbins)
bincenters = 0.5 * (bin_edges[1:] + bin_edges[:-1])

Expand Down

0 comments on commit 5dd2c92

Please sign in to comment.