Transparent TFrame

Hi all,

I’m having a spot of bother attempting to display two graphs on top of each other; I have three line graphs all with the same scale and y-axis working fine, but cannot get another pad to plot over the top while transparent. I can set it from the editor (specifically it seems to be the TFrame::TFrame editor for my canvas c5), but no code I have tried can set it by default, which I need as I intend to automatically save an image of the plot.


fQ1->Draw("f.v:f.t","","same");
TGraph *plt5a = new TGraph(fQ1->GetSelectedRows(),fQ1->GetV2(),fQ1->GetV1());
plt5a->SetTitle("Pressure Plots;Time/s;Pressure/V");
fQ2->Draw("f.v:f.t","","same");
TGraph *plt5b = new TGraph(fQ2->GetSelectedRows(),fQ2->GetV2(),fQ2->GetV1());
fQ3->Draw("f.v:f.t","","same");
TGraph *plt5c = new TGraph(fQ3->GetSelectedRows(),fQ3->GetV2(),fQ3->GetV1());

fQ0->Draw("f.v:f.t","","same");
TGraph *plt5d = new TGraph(fQ0->GetSelectedRows(),fQ0->GetV2(),fQ0->GetV1());
plt5d->SetTitle(";;Temperature/C");
plt5d->GetHistogram()->GetYaxis()->SetTitleOffset(1.25);

plt5a->SetLineColor(2);
plt5b->SetLineColor(3);
plt5c->SetLineColor(4);
plt5d->SetLineColor(6);
TCanvas *c5 = new TCanvas("c5","Plot Five");
TPad *p1 = new TPad("p1","",0,0,1,1);
gPad->DrawFrame(0,minY,countQ,maxY,"mainframe");
TFrame *mainframe = gPad->GetFrame();
mainframe->SetFillStyle(0);
p1->SetGrid();
TPad *p2 = new TPad("p2","",0,0,1,1);
p2->SetFillStyle(0);
plt5d->SetFillStyle(0);

p1->Draw();
p1->cd();
plt5a->Draw("AL");
plt5b->Draw("L");
plt5c->Draw("L");

gPad->Update();


p2->Draw();
p2->cd();
plt5d->Draw("ALY+");
gPad->Update();

c5->cd();
c5->SetFillStyle(0);
c5->Modified();
c5->Update();

I’m happy to provide the TTree if necessary, but would guess that there is just a line I cannot find on previous forum posts!

Thanks in advance,
Alistair


_ROOT Version:_6.12
Platform: Linux
Compiler: Not Provided


save the edited Pad in a .C file and see the necessary commands reproducing the editing you did.

1 Like

Thank you for this; I didn’t even realise that saving a plot as a macro was a feature! I found the one change hidden away on line 114908, but it was there!

For reference, it was p2->SetFrameFillStyle(0);

Yes, it is. I use it very often myself to retrieve what is the necessary command to change some graphics attribute

1 Like

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