faca87
1
Hello, is there a way to force the exponent of the scientific notation in the TGraph?
I mean, I get a scale *10^-6. I would like to get in 10^-5
I even tried the DrawFrame as @couet used here TGraph set maximum number of digits not working - #6 by couet, in addition to the SetMaxDigits, but without results…
lcdata.txt (72 Bytes)
lcplot.cpp (2.3 KB)
ferhue
2
A workaround would be:
graph->Scale(1./1e-5, "y");
graph->GetYaxis()->SetTitle("Flux Mev ... / 1e-5)
couet
3
Yes the power of 10 are multiple of 3. Note that in you example DrawFrame is useless as you draw the graph with option "A’ which will redraw the axis.
faca87
4
thank you the both.
i tried the scale, but the points disappear and i still get 10^-6
lcdata.txt (72 Bytes)
lcplot.cpp (2.3 KB)
ferhue
5
Try calling Scale earlier in the script, just after new TGraphErrors
@couet do you know why it depends on what position it is called frmo?
couet
6
The following works for me:
void lcplot() {
TGraphErrors *graph1 = new TGraphErrors("LCdata.txt","%lg %lg %lg %lg");
graph1->Scale(1./1e-5, "y");
graph1->Draw("AP");
}
ferhue
7
Ok, thanks, so this works:
void lcplot() {
TGraphErrors *graph1 = new TGraphErrors("LCdata.txt","%lg %lg %lg %lg");
graph1->Scale(1./1e-5, "y");
graph1->GetXaxis()->SetLimits(60479, 60492);
graph1->Draw("AP");
}
but this fails:
void lcplot() {
TGraphErrors *graph1 = new TGraphErrors("LCdata.txt","%lg %lg %lg %lg");
graph1->GetXaxis()->SetLimits(60479, 60492);
graph1->Scale(1./1e-5, "y");
graph1->Draw("AP");
}
Not sure if Scale should be modified to update the y-limits if x-limits were set.
faca87
8
Hello, thank you.
Moving the
graph1->Scale(1./1e-5, "y");
just after
GraphErrors *graph1 = new TGraphErrors("LCdata.txt","%lg %lg %lg %lg");
set the 10^-5 scale…
but the 10^-5 factor
lcdata.txt (72 Bytes)
lcplot.cpp (2.3 KB)
disappears…
ferhue
9
Yes, it disappears, that’s the idea / trick. Set it instead in the Y-axis title.
graph1->GetYaxis()->Settitle (“flux / 1e-5”);
faca87
10
Unfortunately, it’s quite orrible to write it in the y-title…
ferhue
11
You can write it instead as a TText or TLatex object at the desired position.
system
Closed
13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.