0
$\begingroup$

In a regular histogram the bin heights reflect the density of observations/data within them. Therefore, the areas of the bins on the chart reflect the quantity of observations they cover. They are for continuous data but the actual data doesn't matter (it could be temperatures for example).

I have data where the observations are themselves frequencies. That is to say, it is data about groups, and the observations are group sizes. I would like the area of the bins to not represent the number of groups, but rather the number of elements in all contained groups (whilst still having group sizes along the x axis).

To put it in a more mathematical light, if the areas of regular histogram bins approximate an integral f(x), f(x) being density of observations, I am looking to indicate the integral of x f(x)

Is there a name for this type of 'histogram'? Even better, is there a way to generate it in a standard python library like matplotlib / seaborn / pandas? Thank you.

$\endgroup$
2
  • $\begingroup$ For seaborn, pass the frequencies into the weights parameter will do what you want (and maybe you have to change stat to density as well). $\endgroup$
    – Andy W
    Jan 9, 2022 at 23:21
  • $\begingroup$ @Andy W Yes, it looks like if I pass the same sequence to the data and the weights parameters, that should do it. Thank you! $\endgroup$
    – user72845
    Jan 9, 2022 at 23:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy