# How to stop drawing lines on histo bins with zero content

**URL:** <https://root-forum.cern.ch/t/how-to-stop-drawing-lines-on-histo-bins-with-zero-content/4160>\
**Category:** ROOT\
**Created:** [December 3, 2006, 5:46am UTC](https://root-forum.cern.ch/t/how-to-stop-drawing-lines-on-histo-bins-with-zero-content/4160 "2006-12-03T05:46:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hits](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hits/32/15840_2.png) [@hits](https://root-forum.cern.ch/u/hits)\
**Post date:** [December 3, 2006, 5:46am UTC](https://root-forum.cern.ch/t/how-to-stop-drawing-lines-on-histo-bins-with-zero-content/4160/1 "2006-12-03T05:46:19Z")

</div>

Hi,

I have made profile histogram from 2D histogram. Now if i am trying to draw it:  
hist11-\>Draw(“HIST PL”);  
It draws the line and the marker through the whole X range of the histogram including empty bins at the end. Like this: [home.fnal.gov/~hits/post.gif](http://home.fnal.gov/~hits/post.gif)

However, if I use:

hist11-\>Draw(“PE”);

It draws only marker for the filled bins but does not connect them with the line.  
Like this: [home.fnal.gov/~hits/post1.gif](http://home.fnal.gov/~hits/post1.gif)  
My goal is to conect markers with the line bur ignore empty bins at the end.

can somebody please tell me what I am not doing?

cheers,

Dmitry.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [December 4, 2006, 1:03pm UTC](https://root-forum.cern.ch/t/how-to-stop-drawing-lines-on-histo-bins-with-zero-content/4160/2 "2006-12-04T13:03:47Z")

</div>

To draw the errors AND the line you should do 2 passes:

```auto
 hist11->Draw("PE");
 hist11->Draw("L SAME");
```

---

<div class="post-metadata">

**Author:** ![hits](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hits/32/15840_2.png) [@hits](https://root-forum.cern.ch/u/hits)\
**Post date:** [December 4, 2006, 3:25pm UTC](https://root-forum.cern.ch/t/how-to-stop-drawing-lines-on-histo-bins-with-zero-content/4160/3 "2006-12-04T15:25:38Z")

</div>

Thanks! It did work with the slight modification!

`
hist11->Draw("PE");
hist11->Draw("HIST L SAME"); `[/quote]

However, it still draws the line through the zero bins at the end. (see [home.fnal.gov/~hits/example2.gif](http://home.fnal.gov/~hits/example2.gif) )

Can you help get rid of it?

Dmitry.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [December 4, 2006, 4:12pm UTC](https://root-forum.cern.ch/t/how-to-stop-drawing-lines-on-histo-bins-with-zero-content/4160/4 "2006-12-04T16:12:05Z")

</div>

You got this line because your data are stored in an histogram. Therefore with option line L, C etc … all the bins are drawn, even the empty ones. To draw only a line through the few points you have, the simplest would be to use a TGraph and draw it on top of the histogram using option L. Do you know how to put these few points in a TGraph ?  
Also, an other simple solution could be to set the histogram minimum to 0.
