Currently, GMT's histogram supports counts and frequency (in percentage) histograms via the -Z option. There are some other useful histograms, e.g., density histogram, which is not supported by GMT yet.
For comparison, matplotlib's hist methods supports "counts" and "density" histograms, while seaborn's histplot method supports more types (see the stat parameter):
count: show the number of observations in each bin [Supported by GMT]
frequency: show the number of observations divided by the bin width [Not supported by GMT]
probability or proportion: normalize such that bar heights sum to 1 [Not supported by GMT]
percent: normalize such that bar heights sum to 100 [Supported by GMT, but GMT calls it "frequency_percent"]
density: normalize such that the total area of the histogram equals 1 [Not supported by GMT]
Here's the math summarized by Claude [the correctness is not confirmed yet].
With n = count in a bin, N = total data points, w = the bin's width.
| stat |
formula |
bars sum to |
area under bars |
| count |
n |
N |
N·w |
| frequency |
n / w |
N/w |
N |
| probability (alias proportion) |
n / N |
1 |
w |
| percent |
100·n / N |
100 |
100·w |
| density |
n / (N·w) |
1/w |
1 |
percent is just probability × 100, so there are really only four distinct quantities. density is the only one that is both normalized and per-unit-x, which is why it's the one with area = 1 and the only one directly comparable to a probability density function.
Currently, GMT's
histogramsupports counts and frequency (in percentage) histograms via the-Zoption. There are some other useful histograms, e.g., density histogram, which is not supported by GMT yet.For comparison, matplotlib's hist methods supports "counts" and "density" histograms, while
seaborn'shistplotmethod supports more types (see thestatparameter):count: show the number of observations in each bin [Supported by GMT]frequency: show the number of observations divided by the bin width [Not supported by GMT]probabilityorproportion: normalize such that bar heights sum to 1 [Not supported by GMT]percent: normalize such that bar heights sum to 100 [Supported by GMT, but GMT calls it "frequency_percent"]density: normalize such that the total area of the histogram equals 1 [Not supported by GMT]Here's the math summarized by Claude [the correctness is not confirmed yet].
With n = count in a bin, N = total data points, w = the bin's width.
percentis justprobability × 100, so there are really only four distinct quantities.densityis the only one that is both normalized and per-unit-x, which is why it's the one with area = 1 and the only one directly comparable to a probability density function.