Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow building histograms with different types of axes #437

Open
mafrahm opened this issue May 22, 2024 · 1 comment · May be fixed by #494
Open

Allow building histograms with different types of axes #437

mafrahm opened this issue May 22, 2024 · 1 comment · May be fixed by #494
Labels
plotting Plotting related things priority-low Low priority stuff

Comments

@mafrahm
Copy link
Contributor

mafrahm commented May 22, 2024

At the moment, each variable that is passed to cf.CreateHistograms will automatically create a variable axis. It would be nice if we can also support some other types of Histogram axes (see Hist docu for possible types of axes).

  • Boolean, StrCategory, and IntCategory might be used if someone needs a second categorical axis, e.g. for trigger studies.
  • Integer might be nice for variables with discrete x values, e.g number of jets.

Implementing the creation of histograms with different axes types should be rather straightforward. We just need to add some auxiliary entry to our variable insts that is used to define how the additional axis is created.

@mafrahm mafrahm added priority-low Low priority stuff plotting Plotting related things labels May 22, 2024
@JulesVandenbroeck
Copy link

JulesVandenbroeck commented May 22, 2024

Hi Mathis,

This is an interesting proposal as this would also make plotting of variables such as number of jets nicer. I tried to do a simple implementation looking at the attribute discrete_x to at least include Integer in cf.CreateHistograms. I came however across an "issue" in how variables are defined in order:

  1. the variable_inst.binning is always converted to a float (see code) which hist axis Integer does not allow. This could be fixed by converting it back to an integer but a change in variables in order would be nice for my next issue
  2. It is not possible to give a type to the variable, this would be the easiest way to decide what histogram axis to use (bool, Integer...) and would be a usefull addition in general to variable attributes as this would also "fix" the binning problem above.

Kind Regards,
Jules

@mafrahm mafrahm linked a pull request Jul 10, 2024 that will close this issue
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plotting Plotting related things priority-low Low priority stuff
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants