Resolution problem with contours in TH2D

Dear experts,

sorry if this was already reported but I couldn’t find it in this forum.

What should I do to see in a viewer or in a printout what I see in a root
canvas? The problem in my case occurs when plotting TH2D with dashed
or dotted contours in a small canvas. The dashed contours are somehow seen in root but in the printout, they become just full lines. I use root 4.04/02 run on linux. I also played with SetLineStyleString but it didn’t help.
Would anybody know how to solve this?

Thank you, the code with an input file is enclosed.

Marek
h0bin2-sa-msusy1000-full.txt (363 KB)
marek.C (1.63 KB)

I do not see any dotted contours on your plot. Both screen and PS outputs look the same.

OK, after a short email exchange, let me share with the working solution Olivier Couet proposed.

The code I enclosed tries to plot a small canvas with TGraph2D with contours:

 TCanvas *c = new TCanvas("c","resol",0,0,500,300);
 TGraph2D *w7 = new TGraph2D(1700,a,b,c);
  w7->SetNpx(200);
  w7->SetNpy(200);
  gStyle->SetHistLineStyle(2);
  TH2D* h7 = w7->GetHistogram("h7");
  double contours[4]={100,120,122,122.8};
  h7->SetContour(4,contours);
  h7->Draw("cont3");

The point is that the dashed contours are not seen in the output. The reason is that for such a small canvas and such a fine binning, there are
just a few pixels per bin so the line segments are very short and hence
there is not enough pixels to even draw one set of dashes.

If one doesn’t insist on the fine binning and can make it coarser, the problem may be solved by putting e.g.

  w7->SetNpx(40);
  w7->SetNpy(40);

Attention, if the data plotted by TGraph2D tend to be flat, one may see
unwanted peaks. They disappear by putting e.g.

 w7->SetNpx(41);
 w7->SetNpy(42);

see couet.home.cern.ch/couet/root/ht13.html

Marek