本文整理汇总了C++中TPaletteAxis::SetLineColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TPaletteAxis::SetLineColor方法的具体用法?C++ TPaletteAxis::SetLineColor怎么用?C++ TPaletteAxis::SetLineColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPaletteAxis
的用法示例。
在下文中一共展示了TPaletteAxis::SetLineColor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlotRakeBunch
//.........这里部分代码省略.........
Double_t *x1bins = new Double_t[NP1X1Bins];
Double_t *eRms = new Double_t[NP1X1Bins];
for(Int_t i=1;i<=hP1X1prof->GetNbinsX();i++) {
x1bins[i] = hP1X1prof->GetBinCenter(i);
eRms[i] = 100 * hP1X1prof->GetBinError(i) / hP1X1prof->GetBinContent(i);
}
gErmsB = new TGraph(NP1X1Bins,x1bins,eRms);
// Vertical Energy histogram:
// --------------------------------------------------------------------------------
TGraph *gP1left = NULL;
if(hP1) {
Double_t *yarray = new Double_t[yNbin];
Double_t *xarray = new Double_t[yNbin];
// This is for the right side:
// Double_t xMax = x1Min + (x1Max-x1Min) * 0.9;
// Double_t xMin = x1Max;
// And this for left:
Double_t xMin = hX1->GetXaxis()->GetXmin();
Double_t xMax = hX1->GetXaxis()->GetXmin() + (hX1->GetXaxis()->GetXmax()
-hX1->GetXaxis()->GetXmin()) * 0.2;
Double_t EneMax = hP1->GetMaximum();
// cout << Form(" EneMax = %f ", EneMax) << endl;
for(Int_t j=0; j<yNbin; j++) {
yarray[j] = hP1->GetBinCenter(j+1);
xarray[j] = ((xMax-xMin)/EneMax)*hP1->GetBinContent(j+1) + xMin;
// cout << Form(" x = %f y = %f ", xarray[j],yarray[j]) << endl;
}
gP1left = new TGraph(yNbin,xarray,yarray);
gP1left->SetLineColor(PlasmaGlob::elecLine);
gP1left->SetLineWidth(2);
gP1left->SetFillStyle(1001);
gP1left->SetFillColor(PlasmaGlob::elecFill);
}
// Plotting
// -----------------------------------------------
// Canvas setup
// Create the canvas and the pads before the Frame loop
// Resolution:
Int_t sizex = 800;
Int_t sizey = 600;
if(opt.Contains("hres")) {
Int_t sizex = 1600;
Int_t sizey = 1200;
}
TCanvas *C = new TCanvas("C1","Evolution of Injection",sizex,sizey);
C->cd();
// Set palette:
PPalette * pPalette = (PPalette*) gROOT->FindObject("electron");
pPalette->cd();
// Float_t Max = hP1X1->GetMaximum();
// Float_t Min = hP1X1->GetMinimum();
// hP1X1->GetZaxis()->SetRangeUser(Min,Max);
示例2: PlotChargeFieldFocus2D
//.........这里部分代码省略.........
Double_t plasmaDGreen[plasmaDNRGBs] = { 0.99, 0.90, 0.00 };
Double_t plasmaDBlue[plasmaDNRGBs] = { 0.99, 0.90, 0.00 };
PPalette * plasmaPalette = (PPalette*) gROOT->FindObject("plasma");
plasmaPalette->CreateGradientColorTable(plasmaDNRGBs, plasmaDStops,
plasmaDRed, plasmaDGreen, plasmaDBlue, plasmaDNCont);
// Change the range of z axis for the fields to be symmetric.
Float_t Emax = hE2D[0]->GetMaximum();
Float_t Emin = hE2D[0]->GetMinimum();
if(Emax > TMath::Abs(Emin))
Emin = -Emax;
else
Emax = -Emin;
hE2D[0]->GetZaxis()->SetRangeUser(Emin,Emax);
Emax = hE2D[1]->GetMaximum();
Emin = hE2D[1]->GetMinimum();
if(Emax > TMath::Abs(Emin))
Emin = -Emax;
else
Emax = -Emin;
hE2D[1]->GetZaxis()->SetRangeUser(Emin,Emax);
// "Axis range" in Osiris units:
Double_t ylow = hDen2D[1]->GetYaxis()->GetBinLowEdge(FirstyBin);
Double_t yup = hDen2D[1]->GetYaxis()->GetBinUpEdge(LastyBin);
Double_t xmin = hDen2D[1]->GetXaxis()->GetXmin();
Double_t xmax = hDen2D[1]->GetXaxis()->GetXmax();
TLine *lineYzero = new TLine(xmin,0.0,xmax,0.0);
lineYzero->SetLineColor(kGray+2);
lineYzero->SetLineStyle(2);
TLine *lineYup = new TLine(xmin,yup,xmax,yup);
lineYup->SetLineColor(kGray+1);
lineYup->SetLineStyle(2);
TLine *lineYdown = new TLine(xmin,ylow,xmax,ylow);
lineYdown->SetLineColor(kGray+1);
lineYdown->SetLineStyle(2);
zStartPlasma -= shiftz;
zStartNeutral -= shiftz;
zEndNeutral -= shiftz;
if(opt.Contains("units")) {
zStartPlasma *= skindepth / PUnits::um;
zStartNeutral *= skindepth / PUnits::um;
zEndNeutral *= skindepth / PUnits::um;
}
// cout << "Start plasma = " << zStartPlasma << endl;
TLine *lineStartPlasma = new TLine(zStartPlasma,ymin,zStartPlasma,ymax);
lineStartPlasma->SetLineColor(kRed);
lineStartPlasma->SetLineStyle(1);
lineStartPlasma->SetLineWidth(2);
// cout << "Start plasma = " << zStartNeutral << endl;
TLine *lineStartNeutral = new TLine(zStartNeutral,ymin,zStartNeutral,ymax);
lineStartNeutral->SetLineColor(kGray+1);
lineStartNeutral->SetLineStyle(1);
lineStartNeutral->SetLineWidth(2);
示例3: PlotRakeInjection
//.........这里部分代码省略.........
hFrame[k]->Draw("axis");
exPlasma->Draw();
// Sum of histograms!
hDen2D[k][0]->Add(hDen2D[k][1]);
// hDen2D[k][0]->GetZaxis()->SetRangeUser(Min[1],Max[1]);
hDen2D[k][0]->Draw("colz same");
pad[k]->Update();
TPaletteAxis *palette = (TPaletteAxis*)hDen2D[k][0]->GetListOfFunctions()->FindObject("palette");
Float_t y1 = pad[k]->GetBottomMargin();
Float_t y2 = 1 - pad[k]->GetTopMargin();
Float_t x1 = pad[k]->GetLeftMargin();
Float_t x2 = 1 - pad[k]->GetRightMargin();
palette->SetY2NDC(y2 - 1*(y2-y1)/2.0 - 0.00);
palette->SetY1NDC(y1 + 0*(y2-y1)/2.0 + 0.00);
palette->SetX1NDC(x2 + 0.005);
palette->SetX2NDC(x2 + 0.03);
palette->SetLabelFont(42);
palette->SetLabelSize(0.03/vfactor);
palette->SetLabelOffset(-0.004);
palette->SetTitleSize(0.03/vfactor);
palette->SetTitleOffset(9999.0*vfactor);
palette->SetBorderSize(2);
palette->SetLineColor(1);
exHot->Draw();
hDen2D[k][2]->Draw("colz same");
pad[k]->Update();
palette = (TPaletteAxis*)hDen2D[k][2]->GetListOfFunctions()->FindObject("palette");
palette->SetY2NDC(y2 - 0*(y2-y1)/2.0 - 0.00);
palette->SetY1NDC(y1 + 1*(y2-y1)/2.0 + 0.00);
palette->SetX1NDC(x2 + 0.005);
palette->SetX2NDC(x2 + 0.03);
palette->SetLabelFont(42);
palette->SetLabelSize(0.03/vfactor);
palette->SetLabelOffset(-0.004);
palette->SetTitleSize(0.03/vfactor);
palette->SetTitleOffset(9999.0*vfactor);
palette->SetBorderSize(2);
palette->SetLineColor(1);
textTime[k] = new TPaveText(x2-0.17,y2-(0.05/vfactor),x2-0.02,y2-0.04,"NDC");
PlasmaGlob::SetPaveTextStyle(textTime[k],32);
char ctext[128];
if(opt.Contains("units"))
sprintf(ctext,"z = %5.0f #mum", skindepth * Time[k] / PUnits::um);
else
sprintf(ctext,"z = %5.1f #omega_{p}^{-1}",Time[k]);
textTime[k]->AddText(ctext);
textTime[k]->Draw();
示例4: PlotEvolutionsWIII
//.........这里部分代码省略.........
// if(!colorPalette) {
// const UInt_t Number = 3;
// Double_t Red[Number] = { 1.00, 0.00, 0.00};
// Double_t Green[Number] = { 0.00, 1.00, 0.00};
// Double_t Blue[Number] = { 1.00, 0.00, 1.00};
// Double_t Length[Number] = { 0.00, 0.50, 1.00 };
// colorPalette = new PPalette("colorPalette");
// colorPalette->CreateGradientColorTable(Number,Length,Red,Green,Blue,np);
// }
// for(Int_t i=0;i<Nfields;i++) {
// for(Int_t ic=0;ic<Ncross;ic++) {
// Float_t step = (np/Nosc);
// Int_t icolor = TMath::Nint( ((ic+1)/2) * step - 1 );
// gEextr[i][ic]->SetLineColor(colorPalette->GetColor(icolor));
// gEextr[i][ic]->SetLineWidth(2);
// gEdephas[i][ic]->SetLineColor(colorPalette->GetColor(icolor));
// gEdephas[i][ic]->SetLineWidth(2);
// }
// }
// --------------------------------------------------------------------------
// Manual coloring:
const Int_t NCOLORS = 5;
// Int_t colors[NCOLORS] = {kMagenta+2,kRed,kBlue,kYellow+2,kCyan+2};
Int_t colors[NCOLORS] = {kGray+3,kGray+2,kGray+1,kGray};
for(Int_t i=0;i<Nfields;i++) {
for(Int_t ic=0;ic<NCross[i];ic++) {
if( !gEcross[i][ic] || !gEextr[i][ic] ) continue;
Int_t index = ic/2;
if(index>=NCOLORS) index = NCOLORS-1;
gEcross[i][ic]->SetLineColor(colors[index]);
gEextr[i][ic]->SetLineColor(colors[index]);
gEextr[i][ic]->SetLineWidth(1);
gEdephas[i][ic]->SetLineColor(colors[index]);
gEdephas[i][ic]->SetLineWidth(1);
// cout << "EEEOOO" << endl;
// if(ic%2) {
// gEcross[i][ic]->SetLineStyle(2);
// gEextr[i][ic]->SetLineStyle(2);
// gEdephas[i][ic]->SetLineStyle(2);
// } else {
// gEcross[i][ic]->SetLineStyle(1);
// gEextr[i][ic]->SetLineStyle(1);
// gEdephas[i][ic]->SetLineStyle(1);
// }
}
}
for(Int_t ic = 0;ic<NFCross;ic++) {
// Graph's attributes
Int_t index = ic/2;
if(index>=NCOLORS) index = NCOLORS-1;
gFcross[ic]->SetLineColor(colors[index]);
if(ic%2-1) {
gFcross[ic]->SetLineStyle(2);
gFextr[ic]->SetLineStyle(2);
} else {
gFcross[ic]->SetLineStyle(1);
示例5: PlotPotential2D
//.........这里部分代码省略.........
// Extract contours
TCanvas* c = new TCanvas("c","Contour List",0,0,600,600);
c->cd();
// Potential
TH2F *hV2Dc = (TH2F*) hV2D->Clone("hV2Dc");
const Int_t Ncontours = 25;
Double_t contours[Ncontours];
for(Int_t i=0; i<Ncontours; i++) {
contours[i] = i*(trapPotential/5.0) - trapPotential;
}
hV2Dc->SetContour(Ncontours, contours);
hV2Dc->Draw("cont list");
c->Update();
TObjArray *contsV2D = (TObjArray*) gROOT->GetListOfSpecials()->FindObject("contours");
TClonesArray graphsV2D("TGraph",Ncontours);
{
Int_t ncontours = contsV2D->GetSize();
TList* clist = NULL;
Int_t nGraphs = 0;
TGraph *gr = NULL;
for(Int_t i = 0; i < ncontours; i++) {
if(i==0) continue;
clist = (TList*) contsV2D->At(i);
for(Int_t j = 0 ; j < clist->GetSize(); j++) {
gr = (TGraph*) clist->At(j);
if(!gr) continue;
gr->SetLineWidth(1);
gr->SetLineColor(kGray+1);
if( !((i)%5) ) {
gr->SetLineWidth(2);
gr->SetLineColor(kGray+2);
}
new(graphsV2D[nGraphs]) TGraph(*gr) ;
nGraphs++;
}
}
}
// Ion probability
hIonProb2D->GetZaxis()->SetRangeUser(0.00501,80);
TH2F *hIonProb2Dc = (TH2F*) hIonProb2D->Clone("hIonProb2Dc");
const Int_t NcontI = 4;
Double_t contI[NcontI] = {0.01,0.1,1.0,10.0};
hIonProb2Dc->SetContour(NcontI, contI);
hIonProb2Dc->Draw("cont list");
c->Update();
TObjArray *contsI2D = (TObjArray*) gROOT->GetListOfSpecials()->FindObject("contours");
TClonesArray graphsI2D("TGraph",NcontI);
{
Int_t ncontours = contsI2D->GetSize();
TList* clist = NULL;
Int_t nGraphs = 0;
TGraph *gr = NULL;
for(Int_t i = 0; i < ncontours; i++) {
clist = (TList*) contsI2D->At(i);
for(Int_t j = 0 ; j < clist->GetSize(); j++) {
示例6: PlotField2D
//.........这里部分代码省略.........
// Define the frames for plotting
Int_t fonttype = 43;
Int_t fontsize = 28;
Int_t tfontsize = 30;
Float_t txoffset = 1.3;
Float_t lxoffset = 0.02;
Float_t tyoffset = 1.0;
Float_t lyoffset = 0.01;
Float_t tylength = 0.02;
Float_t txlength = 0.04;
TH2F *hFrame = (TH2F*) gROOT->FindObject("hFrame");
if(hFrame) delete hFrame;
hFrame = (TH2F*) hE2D[index]->Clone("hFrame");
hFrame->Reset();
// Format for y axis
hFrame->GetYaxis()->SetTitleFont(fonttype);
hFrame->GetYaxis()->SetTitleSize(tfontsize);
hFrame->GetYaxis()->SetTitleOffset(tyoffset);
hFrame->GetYaxis()->SetLabelFont(fonttype);
hFrame->GetYaxis()->SetLabelSize(fontsize);
hFrame->GetYaxis()->SetLabelOffset(lyoffset);
hFrame->GetYaxis()->SetTickLength(tylength);
// Format for x axis
hFrame->GetXaxis()->SetTitleFont(fonttype);
hFrame->GetXaxis()->SetTitleSize(tfontsize+2);
hFrame->GetXaxis()->SetTitleOffset(txoffset);
hFrame->GetXaxis()->SetLabelFont(fonttype);
hFrame->GetXaxis()->SetLabelSize(fontsize+2);
hFrame->GetXaxis()->SetLabelOffset(lxoffset);
hFrame->GetXaxis()->SetTickLength(txlength);
hFrame->Draw("col");
// hE2D[index]->GetZaxis()->SetNdivisions(505);
hE2D[index]->GetZaxis()->SetTitleFont(fonttype);
hE2D[index]->Draw("colz same");
// Re-touchs
gPad->Update();
Float_t y1 = gPad->GetBottomMargin();
Float_t y2 = 1 - gPad->GetTopMargin();
Float_t x1 = gPad->GetLeftMargin();
Float_t x2 = 1 - gPad->GetRightMargin();
Float_t gap = 0.005;
TPaletteAxis *palette = (TPaletteAxis*)hE2D[index]->GetListOfFunctions()->FindObject("palette");
if(palette) {
palette->SetY2NDC(y2 - gap);
palette->SetY1NDC(y1 + gap);
palette->SetX1NDC(x2 + 0.005);
palette->SetX2NDC(x2 + 0.03);
palette->SetTitleOffset(tyoffset);
palette->SetTitleSize(tfontsize);
palette->SetLabelFont(fonttype);
palette->SetLabelSize(fontsize);
if(opt.Contains("logz"))
palette->SetLabelOffset(0);
else
palette->SetLabelOffset(lyoffset);
palette->SetBorderSize(2);
palette->SetLineColor(1);
}
// Text objects
TPaveText *textTime = new TPaveText(xMax - 0.30*xRange, yMax-0.10*yRange, xMax-0.02*xRange, yMax-0.02*yRange);
PGlobals::SetPaveTextStyle(textTime,32);
char ctext[128];
if(opt.Contains("units") && n0)
sprintf(ctext,"z = %5.1f #mum", Time * skindepth / PUnits::um);
else
sprintf(ctext,"#omega_{p} t = %5.1f",Time);
textTime->AddText(ctext);
TPaveText *textDen = new TPaveText(xMin + 0.02*xRange, yMax-0.10*yRange, xMin + 0.40*xRange, yMax-0.02*yRange);
PGlobals::SetPaveTextStyle(textDen,12);
textDen->SetTextColor(kOrange+10);
if(opt.Contains("units") && n0) {
sprintf(ctext,"n_{0} = %5.2f x 10^{17} / cm^{3}", 1e-17 * n0 * PUnits::cm3);
textDen->AddText(ctext);
textDen->Draw();
}
textTime->Draw();
gPad->RedrawAxis();
C->cd();
// Print to a file
PGlobals::imgconv(C,fOutName,opt);
// ---------------------------------------------------------
}