Moving Z axis for TH2

Hi,

Is there any way to move and resize the z axis of a TH2F (I am drawing using the “col” or “colz” option) - I can’t find any simple way of doing this through the documentation. Currently I have a TH2D that fills an entire pad such that the axis is drawn off the side of the pad, I want to be able to replace it within the pad so that it overlays the histogram.

Thanks

Matt

You can change the Z axis limits using SetMaximum() and SetMinimum() on the TH2.
But may be that’s not what you are talking about. The second part of your question confuses me a bit:

[quote]
Currently I have a TH2D that fills an entire pad such that the axis is drawn off the side of the pad, I want to be able to replace it within the pad so that it overlays the histogram. [/quote]
do you have a small running example illustrating what you mean by that ?

I don’t want to change the range of the axis, but move the axis itself.

Currently within my macro I have:

TProfile2D *rampMapPartial = new TProfile2D();

//some functions to get the profile

	cRampMapPartial = new TCanvas("cRampMapPartial","cRampMapPartial",xSizeRampPartial,ySizeRampPartial);
	gPad->SetLeftMargin(0);
	gPad->SetRightMargin(0);
	gPad->SetTopMargin(0);
	gPad->SetBottomMargin(0);
	rampMapPartial->SetTickLength(0,"XY");
 	rampMapPartial->DrawCopy("col");

	eventHist = new TH2D("eventHist","eventHist",xSizeRampPartial/2,xMinPartial,xMaxPartial,ySizeRampPartial/2,yMinPartial,yMaxPartial);

//fill the eventhist with some information
  eventHist->Draw("same and col");


  TPaletteAxis *palette = (TPaletteAxis*)eventHist->GetListOfFunctions()->FindObject("palette");

then anythins I try to do with palette, such as SetX1NDC or paintpave causes a seg fault.

after:

  eventHist->Draw("same and col"); 

you need:

gPad->Modified():
gPad->Update();

ah, now seems to be working with colz.

Thanks!