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

ChangeLabel does not work for logarithmic axes

    XMLWordPrintable

    Details

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

      Root version 6.08/02 on Mac OS X 10.11.6 built using macports.

      Description

      The recent root release 6.08 has added functionality which allows to modify the individual labels of an axis through the TAxis::ChangeLabel function. This works well for axes with linear scale, however, the new functionality seems to be absent for logarithmic scale.

      It seems to me that this is simply a result of the fact that the needed call to ChangeLabelAttributes is missing in the part or TGaxis::PaintAxis which is responsible for labels on a logarithmic axis.

      For reference: for the linear-scale part, the call is performed in line 1780. Naively, this issue could be fixed by adding a similar call to ChangeLabelAttributes somewhere before line 1966. However, this will only apply the ChangeLabel logic to the normal labels (i.e. those which are powers of ten). Additional labels requested through TAxis::SetMoreLogLabels are created in line 2019 et seqq.. As far as I can tell, these don't share the same indexing scheme as the ordinary labels which makes the logic that selects the appropriate label style more difficult.


      Minimum Code Example to reproduce the problem:

      TH1F * h = new TH1F("","", 200,-10, +10);
      h->FillRandom("gaus", 10000);
      h->GetYaxis()->ChangeLabel(1,-1,-1,-1,kRed,-1,"Zero");
      h->Draw();
      // The first y-axis label is modified.
      gPad->SetLogy();
      // Logscale -> Now the first y-axis label is no longer modified
      gPad->SetLogy(false);
      // Once again Linscale and the first y-axis label is modified

        Attachments

          Activity

            People

            • Assignee:
              couet Olivier Couet
              Reporter:
              fawilk Fabian Wilk (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Actual End: