Draw axis ticks on both sides

Hi experts,

For “regular” histograms, graphs etc, I could get the axis ticks to be on both sides simply with

  gStyle->SetPadTickX(1);
  gStyle->SetPadTickY(1);

which is very nice. However I see that this option doesn’t apply to custom axes. I’ve tried finding something like that in the TGaxis class but saw nothing. Do you know how I can get the desired effect, preferably without cloning and resetting the values?

I’ve tried cloning too, but I didn’t find a Set/GetXmax and Y methods either.

Cheers,
Afiq

Draws an other axis without labels on top of the plot. That’s an other axis…I do not understand how you want to do this with a single TGaxis ? … do you have an example ?

I don’t have a simple MWE, but that’s exactly what I want. Since SetPadTickX(1) works, there has to be a way to automatically read the range of the plot and make the corresponding axis. How can I do that also for custom TGaxis? TGaxis itself doesn’t appear to provide a GetXmin etc as I mentioned.

I understand that this presupposes that the axes will be drawn in the usual places, while TGaxis is more general than this. Nevertheless I think this is a very common use case.

TGaxis is the basic low level axis painter used to draw all axis you can see in ROOT. It is a painter which draws what you tell it to draw. it does not manage th coordinates. It is up to you to tell it what to do … It won’t return you anything.

Well ok, but since it accepts xmin, xmax in the ctor, having some ways to read them would be wonderful.

Similarly for setter methods, since it allows one then to simply do clone the desired axis and change only the coordinates.

They exist. Inherited from TLine. But that would not be a great help. They will return you back what you put in.

Perfect, that’s the info I’m missing. That’s enough to make the cloning work, which is still help when dealing with a lot of plots with different ranges.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.