Rotating 1D Histograms

I am trying to make a print out of 4 histograms in an orientation that mimics the geometry of a detector we’re using. The detector is a box with one CCD on each of four sides, so I’d like to arrange a canvas where one histogram is at the top in standard orientation, one is on the right rotated 90 degrees clockwise, a third is at the bottom rotated 180 degrees, and the final histogram on the left rotated 270 degrees.

I’ve looked at other posts that recommended using the hbar option to obtain a horizontal orientation, but that approach doesn’t go quite far enough to allow me the flexibility of rotating that I need. I also tried making a lego plot and using SetTheta and SetPhi, which made it possible to achieve the bottom plot, but of course can’t give me the horizontal orientations.

Any help would be greatly appreciated.


Check the class … escription
See: .
Look for the method
void ShowXForm::showIt()

I’ve never run into Qt before, so it’s going to take me awhile to get myself situated with that. So there’s no way to rotate a pad or histogram using root classes?

Thank you very much for your help.

Hi Jeff,
do you want to rotate an “object” or an image of histogram?,
because these are different cases.
In the later case you can convert/save what is drawn in a canvas as an image and
then rotate it, and display it.
For creation of rotated image you can use TImage class.

Regards. Valeriy Onuchin

What you’re talking about would be perfectly sufficient I think, and it’s one of the approaches I’ve tried. Looking through the TImage documentation, though, I haven’t been able to figure out the best way to effect a rotation once the image object is created. Could you give me more specifics or an example of how to do that?

TImage methods are described at (we need to change/improve it).

You can use TImage::Flip … Image:Flip
TImage::Mirror … age:Mirror

TImage can be drawn in TPad. See rose_image.C from ROOT tutorials.

Regards. Valeriy

[quote=“jklukas”]I’ve never run into Qt before, [/quote]Please find the source, Qt project and screenshot attached. (This can be done with no compilation from the CINT too providing you installed “qtcint” dictionary
RotatePad.cxx (1.83 KB) (1.25 KB)

[quote=“Valeriy Onuchin”]TImage::Mirror … age:Mirror
methods.[/quote] I think the “mirrored” image of the histrogram would look quite funny :stuck_out_tongue:

Thanks, Valeri. I’ll check and fix.

[quote=“fine”][quote=“Valeriy Onuchin”]TImage::Mirror … age:Mirror
methods.[/quote] I think the “mirrored” image of the histrogram would look quite funny :stuck_out_tongue:[/quote]

:laughing: :laughing: :laughing: