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

Making bins spaced evenly on a log scale with np.logspace #2

Open
GuillermoFidalgo opened this issue May 11, 2022 · 0 comments
Open

Comments

@GuillermoFidalgo
Copy link

GuillermoFidalgo commented May 11, 2022

This is more of a neat trick that can be used instead of making the number of bins > 10,000
and it doesn't have large sized bins at the beginning when setting x axis to log scale. 👍🏼

import numpy as np


# nbins = 30_000
nbins= 500
low = 0.25
up = 300
bins = np.logspace(np.log10(low),np.log10(up),num = nbins+1)
# h = df_mass.Histo1D(("Dimuon_mass", "Dimuon_mass", nbins, low, up), "Dimuon_mass")
h = df_mass.Histo1D(("Dimuon_mass", "Dimuon_mass", nbins, bins), "Dimuon_mass")

Now the histogram looks like this
image

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

No branches or pull requests

1 participant