TypeError: void TAttLine::SetLineWidth. Setting Float Widths

Hi All,

I have the following question. In root. C scripts, I’m able to set the line width to whatever decimal fraction we might prefer.

However, now I want to do the following in pyroot:

data.SetLineWidth(0.5)

data is a th2f histogram btw.

This gives the error:

data.SetLineWidth(1)

This works fine however. What is it that is happening here? Am I doing something wrong?

Greetings,
Jelmer

The line width is an integer.

I guess you tried with ROOT 5 in C++…

ROOT 5 does not complain:

root [0] hpx->SetLineWidth(0.5)
root [1] 

But ROOT 6 does:

root [0] hpx->SetLineWidth(0.5)
ROOT_prompt_0:1:19: warning: implicit conversion from 'double' to 'Width_t'
      (aka 'short') changes value from 0.5 to 0 [-Wliteral-conversion]
hpx->SetLineWidth(0.5)
~~~               ^~~
root [1] hpx->SetLineWidth(5)
root [2]  

And that’s clearly said in the doc:

root.cern.ch/root/htmldoc/TAttLine.html#L2