Home | News | Documentation | Download

Shift yaxis "bin edge" in TH1

Consider this example:

  TCanvas *c = new TCanvas;
  c -> SetGridy();
  TH1 * h = new TH1F("h", "h", 5, 0.0, 5.0);
  h -> GetYaxis() -> SetRangeUser(0.8, 1.4);
  h -> GetYaxis() -> SetNdivisions(2);
  h -> Draw();

I would like to shift the “bin edge” of the y axis at 1.1 to 1.0 (as it is a value of special importance).

How to do it?


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi,
I am not sure I have understood you. There are no bins in the y axis, since it is a 1D histogram. Are you talking about the axis divisions ? The min/max of the histograms ?

Lorenzo

instead of

bin

please read

division

.

How then would you like to have the divisions in the y axis and using which range ?

Everything as in the example, except that the division edge is not at 1.1 but at 1.0.

@couet might know the correct answer for this and if it is possible to have non-equidistant divisions.
I would change min/max or number of divisions such you will get 1.0 as edge value.

These are the parameters that I would like not to be changed.
I imagine that the task is solvable but using TLatex and TLine to redraw axis labels and grid lines, but perhaps there is a much simper solution.