Draw("SURF") and SetMinimum()

Hi there,

I am currently struggling with setting the z-axis on a TF2. SetMinimum() does work to change the range, however all values below the minimum of the axis are then plotted as if they were exactly this minimum. Is there an option to discard all areas which exceed the z axis limits?

Minimal working example with one corner falling below the minimum:

void testTF2(){
TF2 f2 = new TF2(“myfunc”,"-xy",0,100,0,100);
f2->SetMinimum(-5.E3);
f2->Draw(“surf2”);
}

When I plot my data with the surf2 option, the very low values are not plotted by default. But as soon, as SetMinimum() was called, everything will be set to the lowest color. Unfortunately I am not allowed to attach more than one picture here.

Is there any easier solution, than editing the palette to have the lowest and highest color set to white?

Thanks in advance,
Falk

This problem seems to exist for all the SURF options as shown below. In addition, the THistPainter documentation does not state that the SURF options are valid for TH3 objects.

{  
   TF2 *f2 = new TF2("myfunc","-x*y",0,100,0,100);
   f2->SetMinimum(-5E3);
   TCanvas* canvas = new TCanvas("canvas");
   canvas->DivideSquare(6);
   for (int i=0;i<6;i++) {
      canvas->cd(i+1)->SetPhi(-60);
      if (i==0) f2->Draw("surf");
      f2->Draw(Form("surf%d",i));
   }
}  

Thanks for the investigation!

But this is 2D data, not 3D. And for TH2 the surf options are listed in the THistPainter documentation.

And in this answer I can also upload my second picture, showing that the surf option in principle seems capable of leaving the bottom blank. Only after calling SetMinimum() everything will be set to purple.

Cheers,
Falk

Sorry, you’re right. Not sure what I was thinking at the time.

what you are looking for is available with the option LEGO if one adds the option 0.

void testTF2()
{
  TF2 *f2 = new TF2("myfunc","-x*y",0,100,0,100);
  f2->SetMinimum(-5.E3);
  f2->Draw("Lego2 0");
}

We can see if this option can be added to SURF too

1 Like

Thanks Olivier,

I guess, I will go with editing the palette to white until then.

Cheers,
Falk

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