Draw 2 objects in different windows?

I create two object: TGraph and TH1F, I want to open they in different window. How can I do it? I make TCanvas:

TCanvas* c1 = new TCanvas("c1","The distribution", 1000, 10, 1000, 700); 
TCanvas* c2 = new TCanvas("c2","The histogram", 10, 10, 1000, 700);
...
c1->cd(1);
DrawAll(Walls);

c2->cd(2);
his->Draw();

But open only one.


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.19/01
Platform: Ubuntu
Compiler: Not Provided


Hi.
In the missing lines there is a c2->Divide(…,…);?
If you have not used “Divide” on your TCanvas c2 you must write c2->cd(); instead of c2->cd(2); (same with c1 for style but writing on the first pad should be equalent to writing on the canvas) or ROOT will try to draw on a pad which doesn’t exist and so maybe you get only a window (the “c1”)
Maybe this will solve the problem (I don’t know if I have understood what you want to do).

How about calling cd() with no arguments:

TCanvas* c1 = new TCanvas("c1","The distribution", 1000, 10, 1000, 700); 
TCanvas* c2 = new TCanvas("c2","The histogram", 10, 10, 1000, 700);
...
c1->cd();
DrawAll(Walls);

c2->cd();
his->Draw();

?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.