Hello Olivier,
I did it as follows.
const UInt_t kColN = 7;
const Double_t kRedArray[kColN] = { 0., 0., .5, 1., 1., 1., 1.}; const Double_t kGreenArray[kColN] = { 0., 0., 0., 0., .5, 1., 1.}; const Double_t kBlueArray[kColN] = { 0., 1., .5, 0., 0., 0., 1.}; const Double_t kStops[kColN] = { 0., .25, .375,.5, .625, .75, 1.};
TColor::CreateGradientColorTable(kColN, (double*)kStops, (double*) kRedArray, (double*)kGreenArray, (double*)kBlueArray, 256);
int GetColor(float val)
{
static TGraph graR(kColN, kStops, kRedArray); static TGraph graG(kColN, kStops, kGreenArray); static TGraph graB(kColN, kStops, kBlueArray); float r = graR.Eval(val/kMax);
return TColor::GetColor(r, g, b);
}
Sincerely
OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp
Institute for Cosmic Ray Research, University of Tokyo
5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan
Phone/Fax : +81 4-7136-3153
Skype : okumura.akira
On 2007/11/08, at 23:01, Olivier Couet wrote:
> Hello,
>
> This functionnality in TPaletteAxis is still not yet implemented.
> It is on the list of item to do.
>
> Cheers, O.Couet
>
> -----Original Message-----
> From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch]
> On Behalf Of OKUMURA, Akira
> Sent: Thursday, November 08, 2007 11:03 PM
> To: roottalk (Mailing list discussing all aspects of the ROOT system)
> Subject: Re: [ROOT] Color of Bins
>
> Hello ROOTers,
>
> http://root.cern.ch/root/roottalk/roottalk03/1899.html
> I read this thread but I could not find the getter in the source of
> TPaletteAxis.
> http://root.cern.ch/root/html/TPaletteAxis.html
>
> Sincerely,
>
> OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp
> Institute for Cosmic Ray Research, University of Tokyo
> 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan
> Phone/Fax : +81 4-7136-3153
> Skype : okumura.akira
>
> On 2007/11/08, at 11:56, OKUMURA, Akira wrote:
>
>> Hello ROOTers,
>>
>> I have a TH2 histogram which is like a world map. X is longitude,
>> and Y is latitude. I would like to change the shape of the
>> histogram using Mollweide projection. TPolyLine will be used to
>> draw each projected bin.
>>
>> My question is:
>> I would like to retrieve the color of each bin. For example,
>>
>> TH2F* hist = new ....
>> for(int i=0; i<hist->GetNbinsX(); i++){
>> for(int j=0; j<hist->GetNbinsY(); j++){
>> int col = hist->GetBinColor(i+1, j+1); // <= any idea?
>> TPolyLine* pol = new TPolyLine;
>> ......
>> pol->SetFillColor(col);
>> pol->Draw("f");
>> }
>> }
>>
>> How can I do like this?
>>
>> Sincerely
>>
>> OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp
>> Institute for Cosmic Ray Research, University of Tokyo
>> 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan
>> Phone/Fax : +81 4-7136-3153
>> Skype : okumura.akira
>>
>
Received on Fri Nov 09 2007 - 19:07:31 CET
This archive was generated by hypermail 2.2.0 : Sat Nov 10 2007 - 17:50:01 CET