TGAxis and fixed label pixel size does not work

Hi all.

I have encountered a strange problem with manually defined TGAxis.
This is what I’ve done:

  1. Plot histogram
  2. gStyle->SetLabelOffset(1000,“XY”) so that the default axes are not plotted
  3. Define my own axes, one for the bottom x, one for the top x axes
  4. Both axes use SetLabelFont(43) and SetTitleFont(43), followed by setting a fixed pixel size
  5. Plotting the bottom TGAxis with option “+” is ok.
  6. Plotting the top TGAxis with option “-” does not print the labels. It does print ticks and title though.
  7. If I define (and plot) the top TGAxis with option “+” is does print everything.

A sample file (minimal example) is attached.

Cheers.

Maurits
test.cxx (1.74 KB)

I am looking at it.
note:

root [0] .L test.cxx
root [1] test()
Warning: wrong member access operator '->' test.cxx:18:
(int)0

It is because of the font precision 3 (font 43) … if you set it to 42 then the labels appear again. I have not idea why yet. I am investigating.

A possible “workaround”:

TGaxis *axis = new TGaxis(gPad->GetUxmin(),
                                           gPad->GetUymax(),
                                           gPad->GetUxmax(),
                                           gPad->GetUymax()*1.0001,
                                           gPad->GetUxmin()*c,
                                           gPad->GetUxmax()*c,fmt,"-");

… still investigating

This problem is now fixed in the SVN trunk. Thanks for reporting it.

Thanks for looking into it and the quick fix.