Suppressing empty bins in histogram pdf output


ROOT Version: 6.16/00
Platform: x86_64 (lxplus)
Compiler: gcc (GCC) 8.2.0


I have a sparse histogram with a very large number of bins (~1 million), and I am trying to output a bar chart from a TH1, via hist->Draw(“HIST B”);

This produces perfectly fine output when printing the canvas as a png.
When printing as a pdf, it also produces a visually good output, but with some issues.

The file size is vast, and the rendering time on every computer I have tested is quite long.

One can visually see the image slowly being rendered.

What seems to be happening is that a vector is used to draw a line along the horizontal axis from bin 1 to bin 2, then bin 2 to bin 3, and so on.

Is there a way to suppress the empty information from being added to the pdf? I see that ‘0’ options add for other draw options, but this does not seem to exist for ‘B’. Am I just being blind?

Yes pdf is vector graphics, all the lines are drawn. The more lines you have the bigger is the file. png is binary output and the size of the file does not depend on the number of lines drawn, it depends only on the canvas size. I would recommend you to use png.

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