00001
00002
00003
00004 #include "TStyle.h"
00005 #include "TColor.h"
00006 #include "TF2.h"
00007 #include "TExec.h"
00008 #include "TCanvas.h"
00009
00010
00011 void Pal1()
00012 {
00013 static Int_t colors[50];
00014 static Bool_t initialized = kFALSE;
00015
00016 Double_t Red[3] = { 1.00, 0.00, 0.00};
00017 Double_t Green[3] = { 0.00, 1.00, 0.00};
00018 Double_t Blue[3] = { 1.00, 0.00, 1.00};
00019 Double_t Length[3] = { 0.00, 0.50, 1.00 };
00020
00021 if(!initialized){
00022 Int_t FI = TColor::CreateGradientColorTable(3,Length,Red,Green,Blue,50);
00023 for (int i=0; i<50; i++) colors[i] = FI+i;
00024 initialized = kTRUE;
00025 return;
00026 }
00027 gStyle->SetPalette(50,colors);
00028 }
00029
00030 void Pal2()
00031 {
00032 static Int_t colors[50];
00033 static Bool_t initialized = kFALSE;
00034
00035 Double_t Red[3] = { 1.00, 0.50, 0.00};
00036 Double_t Green[3] = { 0.50, 0.00, 1.00};
00037 Double_t Blue[3] = { 1.00, 0.00, 0.50};
00038 Double_t Length[3] = { 0.00, 0.50, 1.00 };
00039
00040 if(!initialized){
00041 Int_t FI = TColor::CreateGradientColorTable(3,Length,Red,Green,Blue,50);
00042 for (int i=0; i<50; i++) colors[i] = FI+i;
00043 initialized = kTRUE;
00044 return;
00045 }
00046 gStyle->SetPalette(50,colors);
00047 }
00048
00049 TCanvas* multipalette() {
00050 TCanvas *c3 = new TCanvas("c3","C3",0,0,600,400);
00051 c3->Divide(2,1);
00052 TF2 *f3 = new TF2("f3","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3);
00053
00054
00055 c3->cd(1);
00056 f3->Draw("surf1");
00057 TExec *ex1 = new TExec("ex1","Pal1();");
00058 ex1->Draw();
00059 f3->Draw("surf1 same");
00060
00061 c3->cd(2);
00062 f3->Draw("surf1");
00063 TExec *ex2 = new TExec("ex2","Pal2();");
00064 ex2->Draw();
00065 f3->Draw("surf1 same");
00066
00067 return c3;
00068 }