Re: Bug in TGraphs to/from file ??

Rene Brun (Rene.Brun@cern.ch)
Mon, 01 Dec 1997 17:59:06 +0100


Martin Woudstra wrote:

> Dear rooters,
>
> The Y-scale in TGraphs seems to get lost if written to file.
>
> I am filling TGraphs in my standalone program using root routines,
> which I then save to a root file with the command:
>
> pGraph->Write(pGraph->GetName());
>
> When I then read it back into root I find the graph in the file,
> but when I try to Draw it with
>
> TFile f("tracks.root");
> TGraph* gY = (TGraph*)f.Get("Graph BML wrt BIL (2,2)");
> TCanvas *cgy = new TCanvas("Example Graph","Example Graph");
> gY->Draw("A*");
>
> No points are shown, because the Y-axis scale is wrong (-1 .. +1).
> The x-axis scale is Ok. If I change the Y-scale (-50 .. +10),
> then the points appear again.
>
> This seems to be a bug to me.
>
> Best regards,
>
> Martin.

Martin,
Thanks for reporting this problem. It is now fixed in our dev version
(will appear
in 1.03/09).
The problem was that the maximum/minimum on the Y axis were not
correctly saved
on the file.
With the current version, you must explicitely SetMaximum and SetMinimum

before drawing.

Rene Brun