mirror of
https://github.com/vale981/bachelor_thesis
synced 2025-03-10 04:46:40 -04:00
15 lines
459 B
Python
15 lines
459 B
Python
|
import matplotlib.pyplot as plt
|
||
|
|
||
|
def draw_histo(points, xlabel, bins=20):
|
||
|
heights, edges = np.histogram(points, bins)
|
||
|
centers = (edges[1:] + edges[:-1])/2
|
||
|
deviations = np.sqrt(heights)
|
||
|
|
||
|
fig, ax = set_up_plot()
|
||
|
ax.errorbar(centers, heights, deviations, linestyle='none', color='orange')
|
||
|
ax.step(edges, [heights[0], *heights], color='#1f77b4')
|
||
|
|
||
|
ax.set_xlabel(xlabel)
|
||
|
ax.set_xlim([points.min(), points.max()])
|
||
|
return fig, ax
|