Re: Draw single TPaletteAxis

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Sun, 17 Oct 2010 10:41:19 +0200


  see example below

Rene Brun

{

    TCanvas *c1 = new TCanvas("c1","c1",600,400);

    Double_t xmin = -4;
    Double_t xmax = 4;
    Double_t ymin = -20;
    Double_t ymax = 20;

    TH2F *h2 = new TH2F("h2","Example of palette with empty histogram",40,xmin,xmax,40,ymin,ymax);

    h2->SetMaximum(100);
    h2->SetEntries(1);
    gStyle->SetPalette(1);
    h2->SetStats(kFALSE);

    h2->Draw("COL");
    c1->Update();
    TPaletteAxis *p = new TPaletteAxis(xmax+0.1,ymin,xmax+0.4,ymax, h2);     p->Draw();
}

On 17/10/2010 10:13, Alexander Voigt wrote:
> Dear ROOT experts,
>
> is there a way to draw a single TPaletteAxis with an arbitrary range,
> without having a histogram? Something like
>
> TPaletteAxis *p = new TPaletteAxis(0, 0, 1, 1, NULL);
>
> does not work unfortunately.
>
> If this is not possible, can one draw an empty 2d-histogram with a
> palette with arbitrary range, such that one can see the palette only?
> Something like
>
> TH2F *h2 = new TH2F("h1","h1",100,0,100, 100,0,100);
> h2->GetZaxis()->SetRange(0,100); // set range of the palette axis
> h2->Draw("COLZ");
>
> seems not to work.
>
> Many thanks in advance for your answers.
>
> Kind regards,
> Alexander Voigt
>
Received on Sun Oct 17 2010 - 10:41:24 CEST

This archive was generated by hypermail 2.2.0 : Sun Oct 17 2010 - 17:50:01 CEST