You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and we should get two figures, upper one with h_* overlaid. Lower with two ratios, to h_2 and h_3. The axes should be aligned, the labels and legends should be taken from the histograms themselves and we should not have to do any manipulation of artists.
Describe alternatives, if any, you've considered
The way the code is implemented is bad, it's too complicated, and I do not have time to make it work the way I need to, so I am moving back to pure matplotlib. The plots I need do not need to be perfect and matplotlib is good enough for me. It would be nice if hist can do quickly what we need though.
Cheers.
The text was updated successfully, but these errors were encountered:
Hi! Has there been any progress on this issue? I would also really appreciate a function that allows for ratio plots with more than two input histograms. I think the two problems labelled above as 1. and 2. are the main ones.
In the above example, h1 is plotted twice on the upper panel.
The user can actually manually solve 2. by specifying sharex=True and plt.subplots_adjust(hspace=.0) in their script. In my opinio, this should not be added to _plot_ratiolike in src/hist/plot.py so that users have more control over the spacing (if they desire to have non-standard spacing).
I think if one does not give axes to the first plot_ratio, they are created first and fused correctly and this unwanted behaviour occurs when one always gives axes to plot_ratio since they are just extracted from the dict in
without further modifications.
There is one complication when using this solution to 2.: The ticks of the upper and the lower limit can overlap, which does not look too nice. The user can prune the ticks using something like ax2.yaxis.set_major_locator(MaxNLocator(nbins=nbins, prune='upper')) with matplotlib.ticker.MaxNLocator where nbins = len(ax1.get_xticklabels()) but of course this is some manual hassle again, sadly.
I see two options to solve problem 1, which would enter at
(because I assume everybody wants to plot ratios with a common denominator...)
Check if more than one "lines" object is on the upper panel already and if yes, do not histplot the denominator.
Add an additional argument (boolean flag) and give control to the user if the denominator should be histplotted, defaulting to True.
I am reluctant to directly propose any particular implementation to solve 1. but if you have a preference I could try myself.
Moving plot_ratio to mplhep might also be an option but I do not know if this is preferred long-term...?
Overall, development in this area would probably be really appreciated by the community because it would be so great to have an easy-to-use interface for flexible ratio plots!
In:
The code is unable to:
rp_*
arguments.Describe the feature you'd like
The user should be able to do:
and we should get two figures, upper one with
h_*
overlaid. Lower with two ratios, to h_2 and h_3. The axes should be aligned, the labels and legends should be taken from the histograms themselves and we should not have to do any manipulation of artists.Describe alternatives, if any, you've considered
The way the code is implemented is bad, it's too complicated, and I do not have time to make it work the way I need to, so I am moving back to pure matplotlib. The plots I need do not need to be perfect and matplotlib is good enough for me. It would be nice if hist can do quickly what we need though.
Cheers.
The text was updated successfully, but these errors were encountered: