You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example code provided in simple_numpy.py might not meet the criteria for high coupling, as it is very similar to the code in simple_2d.py. I recommend you to delete this redundancy example OR possibly add more comments to the simple_2d.py like this:
importboost_histogramasbhimportmatplotlib.pyplotaspltimportnumpyasnp# Create 2d-histogram with two axes with 20 equidistant bins from -3 to 3h=bh.Histogram(
bh.axis.Regular(50, -3, 3, metadata="x"), bh.axis.Regular(50, -3, 3, metadata="y")
)
# Generate some Numpy arrays with data to fill into histogram,# in this case normal distributed random numbers in x and yx=np.random.randn(1_000_000)
y=np.random.randn(1_000_000)
# Fill histogram with Numpy arrays, this is very fasth.fill(x, y)
# Get numpy.histogram compatible representation of the histogram# or create a view of the counts (no copy involved)w, x, y=h.to_numpy()
# x = h.axes[0].edges# y = h.axes[1].edges# w = h.view()# Draw the count matrixfig, ax=plt.subplots()
mesh=ax.pcolormesh(x, y, w.T)
ax.set_xlabel(h.axes[0].metadata)
ax.set_ylabel(h.axes[1].metadata)
fig.colorbar(mesh)
plt.savefig("simple_2d.png")
The text was updated successfully, but these errors were encountered:
The example code provided in simple_numpy.py might not meet the criteria for high coupling, as it is very similar to the code in simple_2d.py. I recommend you to delete this redundancy example OR possibly add more comments to the simple_2d.py like this:
The text was updated successfully, but these errors were encountered: