This commit is contained in:
David Baranyai 2017-10-31 15:23:12 +01:00
commit 2e18948851
2 changed files with 23 additions and 9 deletions

View File

@ -23,7 +23,9 @@ class Plotter
{ {
public: public:
Plotter(bool draw); Plotter(bool draw);
~Plotter();
void Plot(Int_t numRuns, Int_t nSteps, std::vector<Double_t> t, std::vector<Double_t> x); void Plot(Int_t numRuns, Int_t nSteps, std::vector<Double_t> t, std::vector<Double_t> x);
TMultiGraph * GetTmultiGraph();
private: private:
bool draw; bool draw;

View File

@ -7,8 +7,21 @@ if(draw)
{ {
canv = new TCanvas("canc","display",800,400); canv = new TCanvas("canc","display",800,400);
} }
//g1 = new TGraph();
mg = new TMultiGraph(); mg = new TMultiGraph();
} }
Plotter::~Plotter()
{
}
TMultiGraph * Plotter::GetTmultiGraph()
{
return mg;
}
void Plotter::Plot(Int_t numRuns, Int_t nSteps, std::vector<Double_t> t, std::vector<Double_t> x) void Plotter::Plot(Int_t numRuns, Int_t nSteps, std::vector<Double_t> t, std::vector<Double_t> x)
{ {
mg->SetTitle("BM1D"); mg->SetTitle("BM1D");
@ -16,22 +29,21 @@ void Plotter::Plot(Int_t numRuns, Int_t nSteps, std::vector<Double_t> t, std::ve
for(int i= 0; i < numRuns; i++) for(int i= 0; i < numRuns; i++)
{ {
g1 = new TGraph(nSteps,&t[i*nSteps],&x[i*nSteps]); g1 = new TGraph(nSteps,&t[i*nSteps],&x[i*nSteps]);
g1->SetLineColor(i%30+1);
g1->SetLineColor(i+1); //g1->SetTitle("Brownian Movement");
g1->SetTitle("Brownian Movement"); //g1->GetYaxis()->SetTitle("X");
g1->GetYaxis()->SetTitle("X"); //g1->GetXaxis()->SetTitle("Time");
g1->GetXaxis()->SetTitle("Time"); g1->SetLineWidth(2);
g1->SetLineWidth(1); //g1->SetMarkerColor(1);
g1->SetMarkerColor(1);
g1->SetMarkerStyle(1); g1->SetMarkerStyle(1);
mg -> Add(g1); mg -> Add(g1);
} }
if(draw) if(draw)
{ {
g1->Draw(); mg -> Draw("APL");
mg -> Draw();
} }
} }