Histograms

IDL's histogram routine is very fast and useful, but it rounds improperly (try:

plot, histogram(findgen(60),nbin=20),ps=10

and you'll see). Also, plotting the results of a histogram can be confusing, especially regarding the first and last bins.

For maximum ease of use, try the following routines:

like this:

y=findgen(50)^2
h=myhist(y,nbin=10,x)
histplot,x,h

and see if you like them. The /overplot flag on histplot allows you overlay histograms. The basey keyword allows you to stack histograms by specifying the height of the bottoms of the various bins.