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).
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 ?
@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.
The axis divisions are equidistant. If having an extra label is acceptable for you you can do:
{
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(5);
h -> Draw();
}