Drawing TPaletteAxis in a separate TCanvas

Dear ROOTers,

I am trying to draw a TPaletteAxis from TH2::Draw(“COLZ”) in a separate TCanvas.
I managed to get something drawn but the coordinates I am specifying via TPaletteAxis::SetX[Y]1[2] are simply ignored. At least the way I am trying; see the attached code. What am I doing wrong?

Thanks,

Moritz

(ROOT 5.17/04; Win32)
separatepalette.C (1.78 KB)

{
   TH2D* h = new TH2D("h", "Example Histo", 20,-1,1,20,-1,1);
   h->FillRandom("gaus", 1E6);
   h->Draw("COLZ");
   gPad->Update();
   TPaletteAxis* zaxis = (TPaletteAxis*)h->GetListOfFunctions()->FindObject("palette")->Clone("MyPalette");
   delete c1;
   delete h;

   TCanvas* pc = new TCanvas("pc", "PaletteCanvas", 50,500);

   pc->cd();
   zaxis->SetX1NDC(0.);
   zaxis->SetX2NDC(1.);
   zaxis->SetY1NDC(0.);
   zaxis->SetY2NDC(1.);
   zaxis->Draw();
   gPad->Modified();
   gPad->Update();
}

OK, I see what I was doing wrong all of yesterday…

Thank you!

Moritz