# RooPlot showing the number of entries instead of the entries value

**URL:** <https://root-forum.cern.ch/t/rooplot-showing-the-number-of-entries-instead-of-the-entries-value/43427>\
**Category:** Newbie\
**Created:** [February 7, 2021, 2:20pm UTC](https://root-forum.cern.ch/t/rooplot-showing-the-number-of-entries-instead-of-the-entries-value/43427 "2021-02-07T14:20:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zero1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zero1/32/24444_2.png) [@zero1](https://root-forum.cern.ch/u/zero1)\
**Post date:** [February 7, 2021, 2:20pm UTC](https://root-forum.cern.ch/t/rooplot-showing-the-number-of-entries-instead-of-the-entries-value/43427/1 "2021-02-07T14:20:56Z")

</div>

I created a variable d with it’s frame

> RooRealVar d(“d”,“distance from the target”,0.0,Distance[0],Distance[NDistance-1]);  
> RooPlot \*dframe = d.frame();

Then created a second variable:

> RooRealVar HitPerc(“#frac{N\_{hit}}{N\_{Tot}}”,“Hit and miss quotient”, 0.0, 0.0, N, “%”);

Here’s the problem: I want to create a dataset where the HitPerc variable is a function of the d variable which I created with:

> RooDataSet \*DataHitPerc = new RooDataSet(“DataH”,“droplets hit versus distance”,RooArgSet(d,HitPerc));

Then I added points to the dataset using

> DataHitPerc → add(RooArgSet(d,HitPerc));

But when I write:

> DataHitPerc → plotOn(dframe);

I obtain as graph the number of entries for each value of d instead of the entries value at a given d; how do I solve it?

_ROOT Version:_ 6.22/06  
_Platform:_ Ubuntu 20.10  
_Compiler:_ (Ubuntu 10.2.0-13ubuntu1) 10.2.0

* * *

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [February 8, 2021, 9:06am UTC](https://root-forum.cern.ch/t/rooplot-showing-the-number-of-entries-instead-of-the-entries-value/43427/2 "2021-02-08T09:06:13Z")

</div>

Hi,

When plotting a dataset in a RooPlot, what is showns is the distribution of the variable, i.e an histogram showing the number of content for each bin in teh variable. By default a RooRealVar is binned with 100 bins in his range.  
What exactly what you like to show, variable 2 vs variable 1 ? In that case is maybe better you crate a scatter plot or a TGraph object yourself with the variable values that you can retrieve from the RooDataSet.

Cheers

Lorenzo

---

<div class="post-metadata">

**Author:** ![zero1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zero1/32/24444_2.png) [@zero1](https://root-forum.cern.ch/u/zero1)\
**Post date:** [February 9, 2021, 9:13pm UTC](https://root-forum.cern.ch/t/rooplot-showing-the-number-of-entries-instead-of-the-entries-value/43427/3 "2021-02-09T21:13:11Z")

</div>

Thank you, creating the tgraph solved it.
