-
Notifications
You must be signed in to change notification settings - Fork 21
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
Ratio inset for plots in DQM Validation module #1382
Comments
Talked with Pritam privately and he agreed to have a look at this. |
I've done this so many times, here is the matplotlib code to do a raw/ratio plot. fig, (raw, ratio) = plt.subplots(
nrows = 2,
sharex = 'col',
height_ratios = [2, 1], # height of raw panel relative to ratio panel
gridspec_kw = dict(
hspace = 0.05 # separation between panels, can be zero to overlap axis lines
)
)
raw.hist(..., label='One')
raw.hist(..., label='Two')
raw.set_ylabel('Events')
raw.legend()
ratio.plot(one/two)
ratio.set_ylabel('Ratio')
ratio.set_xlabel('X Label / Units')
fig.savefig('filename.png', bbox_inches='tight')
fig.close() # only helpful in scripts like Validation where we want to cleanup figures that are done |
That is what the above code does. Vocab Change
The code above is basically following this guide but with some extra parameters I've learned while tuning the plots to be closer to what we want. |
Ahh perfect, I didnt read it carefully! Will you PR it @tomeichlersmith ? |
Got a draft on the attached branch 👍 not sure when I'll get a chance to test it |
I can give a try to testing, do you wanna open a draft PR? |
Is your feature request related to a problem? Please describe.
Right now the
Validation
module offers to overlay 1D histograms.Describe the solution you'd like
I believe it would be super useful to automatically generate a ratio plot in the bottom of the overlaid plot to show the differences.
Describe alternatives you've considered
One could do this outside of the
Validation
module in a private script, but wouldnt it be easier to do this once and have it in ldmx-sw?The text was updated successfully, but these errors were encountered: