In this example, plot ticks coincide with bin edges.
import numpy as np import matplotlib.pyplot as plt data = np.random.default_rng(1234).rayleigh(1,40) counts, edges, bars = plt.hist(data, edgecolor="red",bins=[0, 1, 2, 3, 4]) plt.bar_label(bars) plt.xticks(edges) plt.savefig('ex348.png', dpi=72) plt.show()
Recent Comments