Small dots on the canvas

Hey all

I’m just trying to make a TH2F which has the x -coordinate v/s y-coordinate for the starting point of particle tracks. I think I am able to plot it just fine. However, for some reason, (I think) SetMarkerStyle leaves these very small tiny dots on the plot and i’m not able to figure out where they’re coming from.

I have attached the plot and the code for reference.
Just to save you some time, here’s how I’m defining and filling my histogram (just one out of the 20 histograms on the code) :

TH2D* h_track_start11 = new TH2D("h_track_start11","Starting Point of Tracks (nospacecharge);X-Coordinate;Y-Coordinate",100,-10,270,100,-130,130);
    h_track_start11->SetMarkerStyle(30);
    h_track_start11->SetMarkerColor(4);

for(blah blah blah){
h_track_start11->Fill(track.Vertex().X(),track.Vertex().Y());
}
h_track_start11->SetTitle("Starting Point of Tracks (nospacecharge)");
h_track_start11->Draw("P SAME");

Does anyone have any idea of what these small dots are? and how to get rid of them? I’m sure they’re not from data.


nospacecharge.C (62.4 KB)

Why not use a TGraph?

This example doesn’t seem to show the same issue, which version of ROOT are you using?

{
   TH2D *h = new TH2D("h","",200,0,250,200,-150,150);
   TGraph *g = new TGraph();

   for (int i=0;i<500;i++) {
      double x = gRandom->Uniform(0,250);
      double y = gRandom->Uniform(-150,150);
      h->Fill(x,y);
      g->SetPoint(g->GetN(),x,y);
   }
   
   h->SetMarkerStyle(30);
   g->SetMarkerStyle(30);

   TCanvas *c = new TCanvas("c","");
   c->Divide(1,2);
   c->cd(1);
   h->Draw("P");
   c->cd(2);
   g->Draw("AP");
}

I’m using version 6_06_08

Any possibility of updating to 6.10.04? Your version is over a year old.

Unfortunately I’m running by jobs over a FermiLab node and it’s up to them to update the root software installed on the node. I wouldn’t say it’s impossible, but it’s just a lot of bureaucracy. Let me try the TGraph method and see where I end up.
Thanks !

I guess these dots come from:
h_track_start[2 … 10]->Draw(“P SAME”);
for which you do not call SetMarkerStyle in your “nospacecharge.C” macro.

Thank you all. I followed up on @Wile_E_Coyote 's suggestion and that fixed the issue.

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