Lost axis titles when printing TCanvas with TF1 to root file


I’m drawing a TF1 to a canvas, then printing the canvas to root files. When I load those saved root files, the resulting plot doesn’t have the labels I set to both axis. If I print to an eps or png, there’s no problem in the resulting files; and also there isn’t any problem in the plot shown in the interactive session where the script is ran to generate the files.

I tried with
ROOT 5.24/00 (trunk@29257, Jun 30 2009, 09:23:51 on linux)
ROOT 5.22/00 (trunk@26997, Jul 22 2009, 23:43:00 on linux)

This seems somewhat related to the topic “Loosing axis title when saving TCanvas with THStack to file”


In order to load the root file (in a new root session) I open TBrowser and then browse to the root file.

Hope it’s useful, and thanks in advance. Cheers.

axis.root (12 KB)
title.C (288 Bytes)

We are aware of this deficiency. Currently we no not save the histogram used to draw the function when saving theTF1 object to a ROOT file. Functions are in many cases added to the list of functions of a histogram (after a fit) and we believe that it would be a big overhead to save the associated histogram with the function. So, for the time being, you have to set the attributes again when reading the ROOT file or save the associated attributes in a TMacro saved with the TF1 object.



Thanks a lot for your answer. 0k, no big deal; it surprissed me while comparing these with the results of Print with eps or png extension.

Thanks again.

The ROOT files contain the list of objects used to create the graphics output whereas all the other graphical output are a direct copy of what you see on screen. Therefore the techniques to create them are very different.