Hi,
I am new to ROOT so this might be an easy question. I am trying to draw a pie chart using python.
After calculating my datas, I store them in an array (named Indexes_array) and try to plot a pie. Here is the part of my code concerned :
TPie::TPie(const char*, const char*, Int_t, Double_t*, Int_t* cols = 0, const char** lbls = 0) =>
could not convert argument 5 (‘numpy.ndarray’ object has no attribute ‘typecode’ and given element size (8) do not match needed (4))
TPie::TPie(const char*, const char*, Int_t, Float_t*, Int_t* cols = 0, const char** lbls = 0) =>
could not convert argument 4 (‘numpy.ndarray’ object has no attribute ‘typecode’ and given element size (8) do not match needed (4))
I tried to change the syntax and to use a list but nothing works. Does anyone know what the problem is ?
Same for numpy. You can use C float (np.float) as there is an overload for that (Olivier’s example uses double, though), but the integers need to be a 4-byte int (np.int32, not np.int).
The buffer interface in PyROOT sucks, and so do the error messages. Most of that was designed in the days of Python2.2, i.e. before the numpy buffer interface (or even numpy) existed.