|
From: Jerzy K. <jer...@un...> - 2015-04-24 11:31:19
|
Le 24/04/2015 12:58, Christian Alis responds to the problem posed by Virgil Stokes > I had the same problem some time ago and what I did is to use bar() to > plot the histogram, which can be done in one line: > > hst, bin_edges = np.histogram(data) > plt.bar(bin_edges[:-1], hst) > > Perhaps this trick can be added in the documentation? > > I am willing to code Virgil's request if many will find this useful. Separating the computation of the histogram, and plotting it is obviously useful. (I needed this in a linguistical simulation context, where plotting had no sense). Actually hist is more or less this, see _axes.py, line 5678, the Axes method hist just calls numpy.histogram. And then plots bars (or uses some other style). So, although completing the documentation might be of general interest, I would NOT recommend adding some new version of hist. This would be misleading. Hist is hist is hist(ogram). It computes the histogram (and eventually plots it). If it is already computed elsewhere, naming the procedure which JUST plots some bars a "histogram" is methodologically very dubious. Jerzy Karczmarczuk |