Skip to content

[hist] implement new POLF and POLN draw options#22913

Open
linev wants to merge 6 commits into
root-project:masterfrom
linev:improve_hist_polar
Open

[hist] implement new POLF and POLN draw options#22913
linev wants to merge 6 commits into
root-project:masterfrom
linev:improve_hist_polar

Conversation

@linev

@linev linev commented Jul 24, 2026

Copy link
Copy Markdown
Member

Since ROOT 6.36 implementation of "POL" draw option was changed. Angle and radius range automatically scaled to visible histogram range filling full 2*Pi angle and [0..max] radius range. This let display TH2 in polar coordinates for any provided range settings, but produced plots are not intuitive.

Therefore two new options for polar coordinates were introduced.

"POLF" - fixed polar coordinates. In such case full histogram X range mapped to -PI .. +Pi. And Y axis mapped to radius. In case of histogram zooming angle and radius of each bin remains the same (therefore name "fixed"), just number of displayed bins are reduced.

"POLN" - natural polar coordinates. In this case X axis directly represents angle value in radians (therefore name "natural") and Y axis is just radius. Such functionality was requested in https://root-forum.cern.ch/t/64949/

Also "POL" was modified. Now X range mapped to [-180 .. 180) range making more intuitive presentation when central histogram X region displayed near angle 0 on the right side of polar plot.

linev added 4 commits July 24, 2026 16:51
Instead direct usage of gPad->GetUxmin() for each histogram bin
copy its value into variable. Do it in color painting where also polar
coordinates are used.
In such case polar ranges remains fixed and when histogram zoomed,
only part of histogram bins will be drawn without rescale of angle and radius ranges
Also POLF draw option automatically use 0 as minimal radius
when Y range of histogram is not negative - then real polar coordinates will be displayed
It is "natural" polar coordinates where X axis represents angle in radians
and Y axis is radius. When zooming range remains fixed.
linev added 2 commits July 24, 2026 17:07
Instead of range [0..360) now X axis will be mapped to [-180..+180) range.
This make more intuitive behaviour during histogram zooming when central
X range of histogram appears around angle 0 near right side
@linev
linev requested a review from dpiparo as a code owner July 24, 2026 15:13
@linev
linev requested a review from couet July 24, 2026 15:19
@github-actions

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 18h 13m 20s ⏱️
 3 874 tests  3 873 ✅ 0 💤 1 ❌
79 763 runs  79 762 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 4b779d7.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant