Label histogram by bins matplotlib [duplicate]
问题 This question already has answers here : Matplotlib - label each bin (2 answers) Closed 2 years ago . I have a histogram in which I want to label the x-axis by bins. The histogram is plotted as a log log graph, but the bins are very specific. The graph: The bins: bins = [0, 0.035, 0.07, 0.15, 0.5, 1, 3, 10, 40] Is there any way I can do this? I believe it would also require getting rid of the current x-axis labels. 回答1: I wrote an example code for you. Basically, all you need was 'set_xticks'