-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue using TColor and saving canvas to ROOT format #16560
Comments
Yes, this is how the colors are implemented. Only the builtins colors are known at saving time in root files. This other formats save the colors (including .C). |
One can store all colors in the canvas if call |
Did you try to call |
Hi sorry for the late reply, I tried and it works for ROOT 6.32 (I am finally able to see the right color in the loaded canvas), while with ROOT 6.30 I get
p.s. just for completeness I made a little mistake in the example above, I load the object in the root file as an histogram, but I would have to load it as a canvas object.. anyway if I substitute |
Looks like you need to use latest ROOT version to get desired functionality. |
Hi @couet, It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise. Sincerely, |
1 similar comment
Hi @couet, It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise. Sincerely, |
Check duplicate issues.
Description
It seems that when saving a canvas to a ROOT file (
SaveAs("c.root")
), colors defined withTColor::GetColor
are not preserved whereas builtin colors are. This can be seen saving the canvas to both . png .root formats, then load the .root and save it again as a .png, and compare the two pngs created.Tagging CMS CAT conveners @lenzip @anigamova and DPROC subconveners @oglez @ttedeschi
Reproducer
Define a save.C macro:
and a load.C macro:
If
h.SetFillColor(TColor::GetColor("#F5BB54"));
is uncommented andh.SetFillColor(kRed)
is commented,c.png
andloaded_c.png
differ (the latter lacks the color), whereas ifh.SetFillColor(TColor::GetColor("#F5BB54"))
is commented andh.SetFillColor(kRed)
is uncommented,c.png
andloaded_c.png
are the same (both properly showing the red fill color).ROOT version
6.32.04
Installation method
Docker image
Operating system
Ubuntu 24.04
Additional context
No response
The text was updated successfully, but these errors were encountered: