Removing TH1F from canvas + histogram move

Dear rooters,

1.I would like to ask you whether it is possible to remove a TH1F histogram from the canvas without deleting the histogram completely using the Delete() command. ( in order to be possible later to redraw it without creating again the same histogram)
2. Is there any command to delete the DrawCopy() of an histogram from the canvas?
3. Is there a fast command to move all the contents of a histogram a integer given number of bins left or right, without rebinning a new histogram,

Thank you for your help

Get a pointer to the histogram to be removed

TH1 *h = (TH1*)gPad->GetPrimitive("name"); gPad->GetListOfPrimitives()->Remove(h); [quote]2. Is there any command to delete the DrawCopy() of an histogram from the canvas?[/quote]
Proceed as above calling Delete instead of Remove or click on the histogram in teh canvas and select “Delete”.

Loop on the bins, calling GetBinContent(i), SetBinContent(i-xx)

Rene

Thank you very much for your answers!

Your proposal of course works but a small problem is the following.The canvas is updated (and the histogram is gone) only when i resize(manually with the mouse) the window of my application. Of course i am using the update commands (i have try several) into my code but it seems not to working properly. I use these lines inside my gui-standalone application.

gPad->GetListOfPrimitives()->Remove(spectras[checked]); //spectras[checked] is a given histogram
gPad->Update();
TCanvas *canvas1=fEcanvas->GetCanvas(); //fEcanvas is the embending canvas of the GUI.
//Legend->DeleteEntry(spectras[checked]);
canvas1->Update();
gClient->NeedRedraw(fEcanvas);

furthermore if for example i have draw several histograms with the Draw(same) option while the first one with the Draw() option, when i am removing the first histogram the axis and the grid lines are removed as well since all of them were done together with that histogram, how can i avoid that, any trick?

Moreover, how it is possible to remove also the Legend entry of the corresponding histogram (without deleting the whole legend box).

You should call canvas->Modified() (or pad->Modified()) before calling canvas->Update()

It is hard to understand what you are trying to achieve. It is obvious that removing the primary histogram setting the pad range will give a problem.

Moreover, how it is possible to remove also the Legend entry of the corresponding histogram (without deleting the whole legend box).

Like for the pad, do

legend->GetListOfPrimitives()->Remove(h);
Rene