Hello Rene,
Thank you for your quick reply. But it does not work as I expected. In the following example, the fit result should be y = x, by the actual result is y = 1.4 x - 0.8
root [0] TGraph* gra = new TGraph root [1] gra->SetPoint(0, 0, -1) root [2] gra->SetPoint(1, 1, 1) root [3] gra->SetPoint(2, 2, 2) root [4] gra->SetPoint(3, 3, 3) root [5] gra->SetPoint(4, 4, 5) root [6] gra->SetMaximum(4) root [7] gra->SetMinimum(0) root [8] gra->Fit("pol1") **************************************** Minimizer is Linear Chi2 = 0.4 NDf = 3 p0 = -0.8 +/- 0.282843 p1 = 1.4 +/- 0.11547(class TFitResultPtr)4329991824
Regards,
-- OKUMURA, Akira oxon@{astro.isas.jaxa.jp,stanford.edu} Institute of Space and Astronautical Science (ISAS/JAXA) Now at KIPAC/SLAC/Stanford Varian Physics #306, 382 Via Pueblo Mall, MC 4060 Stanford, CA 94305-4060 TEL 650-736-0971/FAX 650-724-5065 Skype : okumura.akira On 2010/10/19, at 11:53, Rene Brun wrote: > Use TGraph::SetMaximum, SetMinimum > > Rene Brun > > > On 19/10/2010 20:45, OKUMURA, Akira wrote:Received on Tue Oct 19 2010 - 21:13:46 CEST
>> Hello ROOTers,
>>
>> Is there any simple way to limit the Y range in TGraph::Fit?
>>
>> The 4th and 5th arguments (rxmin, rxmax) in the regular TGraph::Fit method are used for the high/low limit of the X axis. But I would like to set rymin and rymax instead.
>>
>> Of course, I can do it manually by removing data points outside the range from a graph. But if there is a better solution which is already implemented, I would use it.
>>
>> Regards,
>>
>> --
>> OKUMURA, Akira oxon@{astro.isas.jaxa.jp,stanford.edu}
>> Institute of Space and Astronautical Science (ISAS/JAXA)
>> Now at KIPAC/SLAC/Stanford
>> Varian Physics #306, 382 Via Pueblo Mall, MC 4060
>> Stanford, CA 94305-4060
>> TEL 650-736-0971/FAX 650-724-5065
>> Skype : okumura.akira
>>
>
This archive was generated by hypermail 2.2.0 : Wed Oct 20 2010 - 11:50:01 CEST