void cl() { auto c = new TCanvas("cc", "cc", 800, 300); int keep[7]= {1,2,3,9,21,41}; const int NMbins = 5; double Mbins[6]={0.,25.,50.,200., 500.,1000.}; auto h1 = new TH1F("h1", "h1", NMbins, Mbins); Int_t nfill = 5000; while (nfill -- > 0) { h1->Fill(200*gRandom->Gaus() + 400); } h1->SetNdivisions(-40); h1->Draw(); c->Update(); TAxis *ax = h1->GetXaxis(); // remove unwanted labels for (int il=1; il<=40; il++) { Bool_t remove = kTRUE; for (int k=0; k<7; k++){ if (il == keep[k]) { remove = kFALSE; break; } } if (remove) { ax->ChangeLabel(il, -1, -1, -1, -1, -1, " "); } } c->Modified(); c->Update(); }