Skip to content

'True' normalisation, and some Hist2D colorbar changes - #8

Open
naidoo88 wants to merge 7 commits into
tylern4:mainfrom
naidoo88:main
Open

'True' normalisation, and some Hist2D colorbar changes#8
naidoo88 wants to merge 7 commits into
tylern4:mainfrom
naidoo88:main

Conversation

@naidoo88

Copy link
Copy Markdown
Contributor

Hi Nick,

Wanted to pass along a couple of changes I've made.

Hist1D

I've added the calculation for a 'true' normalization (area under the histogram = 1), mirroring matplotlib's definition of density. So as to not interfere with any legacy code, I have called this density_norm. I have also left density as the default, but when density_norm is used, it supersedes this default behavior, with a warning message to let the user know that density has been disabled.

Further to this, I have included the uncertainty calculations for both density and density_norm. If no errorcalc is specified, but density or density_norm are used, the correct error calculation is automatically selected.

Hist2D

In order to be able to do some 'after the fact' colorbar tweaks the colorbar is now an object of the class. e.g, after plotting the Hist2D object:

my2Dhist.colorbar.ax.tick_params(which='major', width=0.7, length=2)

Further to this, to enable more control over the colorbar, I have added a 'kwargs' variable colorbar_params.
To preserve your default styling, the colorbar aspect is set to 20 when no colorbar_params argument is provided.

cbar_params={
    'pad':-0.05,
    'aspect':20
}
my2Dhist.plot(ax=ax, colorbar_params=cbar_params)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant