faca87
April 27, 2021, 2:30pm
1
Hello, i’ve this macro, but i’ve to modify it to write insteat of “1,2,3” on the x-axis “cathetomiter, phyphox, arduino”
Is it possible to do it?
sigmavalue.cpp (3.0 KB)
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
You can use SetBinLabel . But a TGraph doesn’t have bins, so you need to get the histogram after drawing the graph, for every bin i (=1,2,3, I suppose):
graph->GetHistogram()->GetXaxis()->SetBinLabel(i,"mylabel_i");
and you may need to update the pad/canvas after this.
faca87
April 27, 2021, 3:28pm
4
Ok, @dastudillo I did it following your code and adding this @couet ’s code SetBinLabel, labels disapear if read and write, update TGraph - #3 by bartosz546
Int_t bin1= graph->GetXaxis()->FindBin(1);
Int_t bin2= graph->GetXaxis()->FindBin(2);
Int_t bin3= graph->GetXaxis()->FindBin(3);
The problem is that cathetometer is so long then it’s cutted
is it possible to rotate (45°) the names so that “cathetometer” will not be cutted? Thank you
couet
April 27, 2021, 3:44pm
5
The data are missing. We cannot run your macro.
faca87
April 27, 2021, 3:45pm
6
Hello @couet
data_sigma_m.txt (52 Bytes)
here the data
faca87
April 27, 2021, 6:47pm
8
Hello @dastudillo I wrote
graph->GetXaxis()->ChangeLabel(0,-45,-1,-1,-1,-1,"");
but the angle doesn’t change
sigmavalue.cpp (3.5 KB)
EDIT: Ok, I solved following this @couet ’s message Horizontal offset of x axis labels - #3 by Adam_Hunyadi
system
Closed
May 11, 2021, 6:48pm
9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.