Scaling arrays (Changing unit…)

I’ve got two arrays, on containing some event IDs (events) and the other the event durations (event_durations) measured in [seconds].

I plot them like this (in a python script with pyroot)

I would like to do a conversion from seconds to minutes and I don’t know how to do that in the “ROOT”-way. Could you give me a hint? Should I copy the whole array and rescale it manually? This is kind of awkward… I’m sure there is an elegant solution.

If your arrays are numpy arrays, they behave like vectors so that you can do

In [5]: import numpy
In [9]: arr = numpy.asarray([3,4,5,6])

In [10]: arr
Out[10]: array([3, 4, 5, 6])

In [11]: arr*5
Out[11]: array([15, 20, 25, 30])

So you could just do event_durations /= 60.

They weren’t, but I’ll do it that way, thanks!

I thought there is maybe a “unit” property or something like that for an axis in a TGraph…