Converting pixels to mm in TH2F histogram


I would like to display an image (TH2F histogram) with axes in mm (or um) units instead of in pixels. I know the conversion rate etc. Is there a straightforward way of doing it?

Thanks for your help!

I think you can change the limits on each axis using TAxis::SetLimits

If you know the conversion rate isn’t it simple to just use pixels in your code? (sorry I don’t have a more constructive comment :sweat_smile:)

My guess is that this histogram has its scales in pixels and that the filling is done with (x,y) in pixels. Once the histogram is displayed, I think @iMi wants to have the axis in mm. As he knows the conversion it is easy to change the axis limits to have them in mm . The method I mentioned earlier does the job.

1 Like


The method did the job. I took the square root of the size of the image (which I know to be a square), substracted 2 pixels and then set the limits according to the product of the pixel number along one axis and the conversion rate. Didn’t take long. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.