Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-8092

TGraph::SetPoint deletes fHistogram

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 5.34/34, 6.04/16
    • Fix Version/s: 6.08/04
    • Component/s: None
    • Labels:
      None
    • Environment:

      SL6

      Description

      Hello,

      I find it very annoying that TGraph::SetPoint(int,double,double) by hard simply deletes the member TGraph::fHistogram. Such, all titles and axis-titles are overwritten and have to be reset.
      TGraph line 2131.

      This avoids that one can simply initialize a TGraph and then set its points.

      Furthermore, for the user it does not become clear, why TGraph::GetXaxis() returns different pointers before and after TGraph::SetPoint(), since one would naively expect that TGraph behaves similarly than TH1 and TAxis is a (direct) member of TGraph.

      It would be more natural, to keep at least the title and axis-titles of the old histogram in some member like fOldHist, or even better have tow fHistograms: one for the cosmetics and one for the axis-ranges. Similarly, it is actually done in TGraph line 1514.

      Example code:
      TGraph g
      cout<<g.GetHistogram()<<endl;
      g.SetPoint(0,0,0);
      cout<<g.GetHistogram()<<endl;

      Thanks and cheers,
      Daniel

        Attachments

          Activity

            People

            • Assignee:
              couet Olivier Couet
              Reporter:
              britzger Daniel Andreas Britzger
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Actual End: