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

TGraph axis titles are lost when gPad->SetLogx(1) is called

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 6.14/00
    • Fix Version/s: 6.16/00
    • Component/s: Graphics
    • Labels:
      None
    • Environment:

      Arch Linux x86_64
      GCC 8.1.1

      Description

      Calling 'gPad->SetLogx(1)', either from a script or interactively by right-clicking the axis, after a TGraph is drawn causes loss of the x- and y-axis title (and formatting).

      I believe this might be because the internal histogram in TGraph is recreated when SetLogx(1) is called? In this process it appears that the axis attributes are not correctly carried over.

      Not sure when this problem appeared, but ROOT 6.10, 6.12 and 6.14 seem to be affected, while ROOT 5 is still OK. I didn't check other versions so far.

      This macro demonstrates the problem

      int foo() {
       
        TGraph* g = new TGraph;
        g->SetPoint(0, 1, 1);
        g->SetPoint(1, 10, 1);
        g->SetPoint(2, 100, 1);
        g->SetPoint(3, 1000, 1);
        g->SetMarkerStyle(20);
       
        new TCanvas;
       
        g->GetXaxis()->SetTitle("x");
        g->GetYaxis()->SetTitle("y");
        g->Draw("AP");
       
        gPad->SetLogx(1);
       
        return 0;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              couet Olivier Couet
              Reporter:
              bbeische Bastian Beischer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Actual Start:
                Actual End: