Use TMultiGraph to get a proper axis autoscaling
This commit is contained in:
parent
3d43dcb5ae
commit
8ca8351b3c
@ -108,15 +108,18 @@ void plotFrc(char *FileName)
|
|||||||
TLegend *legend = new TLegend(0.8, 0.8, 0.95, 0.95);
|
TLegend *legend = new TLegend(0.8, 0.8, 0.95, 0.95);
|
||||||
legend->SetFillColor(TColor::GetColor(255,255,255)); // white
|
legend->SetFillColor(TColor::GetColor(255,255,255)); // white
|
||||||
|
|
||||||
|
TMultiGraph *mg = new TMultiGraph();
|
||||||
|
|
||||||
if (Flag[0]==1){
|
if (Flag[0]==1){
|
||||||
TGraph *gr1 = new TGraph(i-1,x,yl1);
|
TGraph *gr1 = new TGraph(i-1,x,yl1);
|
||||||
gr1->GetXaxis()->SetTitle(xlab);
|
gr1->GetXaxis()->SetTitle(xlab);
|
||||||
gr1->GetYaxis()->SetTitle("Implanted Fraction");
|
gr1->GetYaxis()->SetTitle("Implanted Fraction");
|
||||||
gr1->Draw("APC");
|
// gr1->Draw("APC");
|
||||||
gr1->SetMarkerStyle(20);
|
gr1->SetMarkerStyle(20);
|
||||||
gr1->SetMarkerColor(TColor::kRed);
|
gr1->SetMarkerColor(TColor::kRed);
|
||||||
gr1->SetLineColor(TColor::kRed);
|
gr1->SetLineColor(TColor::kRed);
|
||||||
legend->AddEntry(gr1,"Layer 1");
|
legend->AddEntry(gr1,"Layer 1");
|
||||||
|
mg->Add(gr1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag[1]==1){
|
if (Flag[1]==1){
|
||||||
@ -124,8 +127,9 @@ void plotFrc(char *FileName)
|
|||||||
gr2->SetMarkerStyle(20);
|
gr2->SetMarkerStyle(20);
|
||||||
gr2->SetMarkerColor(TColor::kGreen);
|
gr2->SetMarkerColor(TColor::kGreen);
|
||||||
gr2->SetLineColor(TColor::kGreen);
|
gr2->SetLineColor(TColor::kGreen);
|
||||||
gr2->Draw("PC");
|
// gr2->Draw("PC");
|
||||||
legend->AddEntry(gr2,"Layer 2");
|
legend->AddEntry(gr2,"Layer 2");
|
||||||
|
mg->Add(gr2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag[2]==1){
|
if (Flag[2]==1){
|
||||||
@ -133,8 +137,9 @@ void plotFrc(char *FileName)
|
|||||||
gr3->SetMarkerStyle(20);
|
gr3->SetMarkerStyle(20);
|
||||||
gr3->SetMarkerColor(TColor::kBlue);
|
gr3->SetMarkerColor(TColor::kBlue);
|
||||||
gr3->SetLineColor(TColor::kBlue);
|
gr3->SetLineColor(TColor::kBlue);
|
||||||
gr3->Draw("PC");
|
// gr3->Draw("PC");
|
||||||
legend->AddEntry(gr3,"Layer 3");
|
legend->AddEntry(gr3,"Layer 3");
|
||||||
|
mg->Add(gr3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag[3]==1){
|
if (Flag[3]==1){
|
||||||
@ -142,8 +147,9 @@ void plotFrc(char *FileName)
|
|||||||
gr4->SetMarkerStyle(20);
|
gr4->SetMarkerStyle(20);
|
||||||
gr4->SetMarkerColor(TColor::kMagenta);
|
gr4->SetMarkerColor(TColor::kMagenta);
|
||||||
gr4->SetLineColor(TColor::kMagenta);
|
gr4->SetLineColor(TColor::kMagenta);
|
||||||
gr4->Draw("PC");
|
// gr4->Draw("PC");
|
||||||
legend->AddEntry(gr4,"Layer 4");
|
legend->AddEntry(gr4,"Layer 4");
|
||||||
|
mg->Add(gr4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag[4]==1){
|
if (Flag[4]==1){
|
||||||
@ -151,8 +157,9 @@ void plotFrc(char *FileName)
|
|||||||
gr5->SetMarkerStyle(20);
|
gr5->SetMarkerStyle(20);
|
||||||
gr5->SetMarkerColor(TColor::kOrange);
|
gr5->SetMarkerColor(TColor::kOrange);
|
||||||
gr5->SetLineColor(TColor::kOrange);
|
gr5->SetLineColor(TColor::kOrange);
|
||||||
gr5->Draw("PC");
|
// gr5->Draw("PC");
|
||||||
legend->AddEntry(gr5,"Layer 5");
|
legend->AddEntry(gr5,"Layer 5");
|
||||||
|
mg->Add(gr5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag[5]==1){
|
if (Flag[5]==1){
|
||||||
@ -160,8 +167,9 @@ void plotFrc(char *FileName)
|
|||||||
gr6->SetMarkerStyle(20);
|
gr6->SetMarkerStyle(20);
|
||||||
gr6->SetMarkerColor(TColor::kViolet);
|
gr6->SetMarkerColor(TColor::kViolet);
|
||||||
gr6->SetLineColor(TColor::kViolet);
|
gr6->SetLineColor(TColor::kViolet);
|
||||||
gr6->Draw("PC");
|
// gr6->Draw("PC");
|
||||||
legend->AddEntry(gr6,"Layer 6");
|
legend->AddEntry(gr6,"Layer 6");
|
||||||
|
mg->Add(gr6);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag[6]==1){
|
if (Flag[6]==1){
|
||||||
@ -169,8 +177,9 @@ void plotFrc(char *FileName)
|
|||||||
gr7->SetMarkerStyle(20);
|
gr7->SetMarkerStyle(20);
|
||||||
gr7->SetMarkerColor(TColor::kAzure+7);
|
gr7->SetMarkerColor(TColor::kAzure+7);
|
||||||
gr7->SetLineColor(TColor::kAzure+7);
|
gr7->SetLineColor(TColor::kAzure+7);
|
||||||
gr7->Draw("PC");
|
// gr7->Draw("PC");
|
||||||
legend->AddEntry(gr7,"Layer 7");
|
legend->AddEntry(gr7,"Layer 7");
|
||||||
|
mg->Add(gr7);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag[7]==1){
|
if (Flag[7]==1){
|
||||||
@ -178,10 +187,12 @@ void plotFrc(char *FileName)
|
|||||||
gr8->SetMarkerStyle(20);
|
gr8->SetMarkerStyle(20);
|
||||||
gr8->SetMarkerColor(TColor::kAzure+7);
|
gr8->SetMarkerColor(TColor::kAzure+7);
|
||||||
gr8->SetLineColor(TColor::kAzure+7);
|
gr8->SetLineColor(TColor::kAzure+7);
|
||||||
gr8->Draw("PC");
|
// gr8->Draw("PC");
|
||||||
legend->AddEntry(gr8,"Back Scat.");
|
legend->AddEntry(gr8,"Back Scat.");
|
||||||
|
mg->Add(gr8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mg->Draw("APC");
|
||||||
legend->Draw();
|
legend->Draw();
|
||||||
|
|
||||||
// I am not sure what this does, but it waits until canvas is closed
|
// I am not sure what this does, but it waits until canvas is closed
|
||||||
|
@ -44,6 +44,8 @@ void plotRge(TString &names)
|
|||||||
|
|
||||||
TGraph *rge[1000];
|
TGraph *rge[1000];
|
||||||
|
|
||||||
|
TMultiGraph *mg = new TMultiGraph();
|
||||||
|
|
||||||
tokens = names.Tokenize(" \t,;");
|
tokens = names.Tokenize(" \t,;");
|
||||||
|
|
||||||
Double_t min = 0, max = 0, xmax = 0, xmin = 0;
|
Double_t min = 0, max = 0, xmax = 0, xmin = 0;
|
||||||
@ -108,6 +110,7 @@ void plotRge(TString &names)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rge[i] = new TGraph(nStep, depth, normStop);
|
rge[i] = new TGraph(nStep, depth, normStop);
|
||||||
|
mg->Add(rge[i]);
|
||||||
|
|
||||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||||
str = ostr->GetString() + ", ";
|
str = ostr->GetString() + ", ";
|
||||||
@ -134,27 +137,9 @@ void plotRge(TString &names)
|
|||||||
color[7] = TColor::kOrange+4;
|
color[7] = TColor::kOrange+4;
|
||||||
color[8] = TColor::kBlue-7;
|
color[8] = TColor::kBlue-7;
|
||||||
|
|
||||||
// plot again deepest to get the right x scale !!
|
|
||||||
// rge[999] = new TGraph(nStepmax, depthmax, normStopmax);
|
|
||||||
|
|
||||||
Int_t last = tokens->GetEntries()-1;
|
Int_t last = tokens->GetEntries()-1;
|
||||||
// Int_t last = imax;
|
|
||||||
rge[last]->SetMarkerStyle(20);
|
|
||||||
rge[last]->GetXaxis()->SetTitle("Depth [nm]");
|
|
||||||
rge[last]->GetYaxis()->SetTitle("Normalized Stopping Profile [%/nm]");
|
|
||||||
|
|
||||||
TCanvas *c1 = new TCanvas("c1", "Range");
|
|
||||||
c1->Show();
|
|
||||||
|
|
||||||
rge[last]->Draw("apc");
|
|
||||||
rge[last]->GetYaxis()->SetRangeUser(min, 1.05*max);
|
|
||||||
// This does not work
|
|
||||||
rge[last]->GetXaxis()->SetRangeUser(xmin, xmax);
|
|
||||||
cout << "xmin =" << xmin << ", xmax = " << xmax << ", imax = " << imax << endl;
|
|
||||||
|
|
||||||
|
|
||||||
Int_t col;
|
Int_t col;
|
||||||
for (i=0; i<last; i++) {
|
for (i=0; i<=last; i++) {
|
||||||
if (color[i] >= 0) {
|
if (color[i] >= 0) {
|
||||||
rge[i]->SetMarkerColor(color[i]);
|
rge[i]->SetMarkerColor(color[i]);
|
||||||
rge[i]->SetLineColor(color[i]);
|
rge[i]->SetLineColor(color[i]);
|
||||||
@ -167,9 +152,10 @@ void plotRge(TString &names)
|
|||||||
delete rand;
|
delete rand;
|
||||||
}
|
}
|
||||||
rge[i]->SetMarkerStyle(20);
|
rge[i]->SetMarkerStyle(20);
|
||||||
rge[i]->Draw("plsame");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mg->Draw("APC");
|
||||||
|
|
||||||
TLegend *legend = new TLegend(0.7, 0.7, 0.95, 0.95);
|
TLegend *legend = new TLegend(0.7, 0.7, 0.95, 0.95);
|
||||||
legend->SetFillColor(TColor::GetColor(255,255,255)); // white
|
legend->SetFillColor(TColor::GetColor(255,255,255)); // white
|
||||||
for (i=0; i<tokens->GetEntries(); i++) {
|
for (i=0; i<tokens->GetEntries(); i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user