# RooFit plotting in JupyRoot 6.24

**URL:** <https://root-forum.cern.ch/t/roofit-plotting-in-jupyroot-6-24/51904>\
**Category:** Roofit and RooStats\
**Tags:** roofit, python, jupyter\
**Created:** [October 9, 2022, 4:33pm UTC](https://root-forum.cern.ch/t/roofit-plotting-in-jupyroot-6-24/51904 "2022-10-09T16:33:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![masterfelu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/masterfelu/32/20740_2.png) [@masterfelu](https://root-forum.cern.ch/u/masterfelu)\
**Post date:** [October 9, 2022, 4:33pm UTC](https://root-forum.cern.ch/t/roofit-plotting-in-jupyroot-6-24/51904/1 "2022-10-09T16:33:50Z")

</div>

I was going through the tutorials for RooFit on PyROOT, and most of them contain the syntax that looks like the one below([line 68 of fitting composite pdf tutorial](https://root.cern/doc/master/rf201__composite_8py_source.html) is an example of such):

```auto
df.plotOn(frame, LineColor="kRed")

```

I found the above syntax in ([ROOT: Arguments for plotOn functions](https://root.cern/doc/master/group__Plotting.html#gadbcf0656508e28a9a31d4edd33549074)).

But when I run the syntax, I get the following error:

```auto
TypeError Traceback (most recent call last)
<ipython-input-8-f62f79d4f25f> in <module>
----> 1 data.plotOn(frame, LineColor="kRed")

TypeError: none of the 2 overloaded methods succeeded. Full details:
  RooPlot* RooAbsData::plotOn(RooPlot* frame, const RooLinkedList& cmdList) =>
    TypeError: RooAbsData::plotOn got an unexpected keyword argument 'LineColor'
  RooPlot* RooAbsData::plotOn(RooPlot* frame, const RooCmdArg& arg1 = RooCmdArg::none(), const RooCmdArg& arg2 = RooCmdArg::none(), const RooCmdArg& arg3 = RooCmdArg::none(), const RooCmdArg& arg4 = RooCmdArg::none(), const RooCmdArg& arg5 = RooCmdArg::none(), const RooCmdArg& arg6 = RooCmdArg::none(), const RooCmdArg& arg7 = RooCmdArg::none(), const RooCmdArg& arg8 = RooCmdArg::none()) =>
    TypeError: RooAbsData::plotOn got an unexpected keyword argument 'LineColor'

```

most importantly,

```auto
TypeError: RooAbsData::plotOn got an unexpected keyword argument 'LineColor'

```

I tried doing the following things:

```auto
from ROOT import * \\ same error as above

from ROOT.RooFit import * \\ same error as above

data.plotOn(frame, RooFit.LineColor="kRed") \\ SyntaxError

data.plotOn(frame, RooFit.LineColor("kRed")) \\ TypeError

```

none of the above worked. **But the one below works like a charm** :

```auto
data.plotOn(frame, RooFit.LineColor(ROOT.kRed)) \\ Works!!

```

I just wanted to share my snippets.  
Also, wanted to ask the experts whether this is just a version problem, a Jupyter notebook problem, or anything else.

Thanks, and welcome!

* * *

_ROOT Version:_ JupyROOT 6.24/00  
_Platform:_ CentOS Linux release 7.9.2009 (Core)  
_Compiler:_ Python 3.8.8

* * *

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [October 10, 2022, 1:18pm UTC](https://root-forum.cern.ch/t/roofit-plotting-in-jupyroot-6-24/51904/2 "2022-10-10T13:18:34Z")

</div>

Hi @masterfelu,

Welcome back to the ROOT forum and many thanks for sharing your snippets!

I am inviting the relevant people to this topic so that they are aware of the issue @jonas, @etejedor. Again, thanks for reporting and sharing.

Cheers,  
J.

---

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [October 10, 2022, 1:50pm UTC](https://root-forum.cern.ch/t/roofit-plotting-in-jupyroot-6-24/51904/3 "2022-10-10T13:50:38Z")

</div>

Hi @masterfelu!

Which ROOT version are you using? The new Pythonic syntax is only available as of ROOT 6.26, as you can read in the release notes:  
[https://root.cern.ch/doc/v626/release-notes.html#new-pythonizations](https://root.cern.ch/doc/v626/release-notes.html#new-pythonizations)

If you want to look at the tutorials with the less pythonic ROOT 6.24 syntax, you have to select the tutorials for 6.24:  
[https://root.cern/doc/v624/group\_\_tutorial\_\_roofit.html](https://root.cern/doc/v624/group __tutorial__ roofit.html)

Cheers,  
Jonas

---

<div class="post-metadata">

**Author:** ![masterfelu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/masterfelu/32/20740_2.png) [@masterfelu](https://root-forum.cern.ch/u/masterfelu)\
**Post date:** [October 10, 2022, 2:49pm UTC](https://root-forum.cern.ch/t/roofit-plotting-in-jupyroot-6-24/51904/4 "2022-10-10T14:49:34Z")

</div>

Thanks a lot, @jonas! That helps a lot!  
I am using ROOT v6.24.  
I thought that the date on [this tutorial file from the latest release](https://root.cern/doc/master/rf201__composite_8py_source.html), Feb 2018, was way before v6.24 was released so it might have worked on v6.24. I guess I should have double-checked that.

---

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [October 10, 2022, 8:23pm UTC](https://root-forum.cern.ch/t/roofit-plotting-in-jupyroot-6-24/51904/5 "2022-10-10T20:23:02Z")

</div>

Ah, I see where the confusion was coming from then! Right, the date written in the tutorial is when it was created, not when it was last edited.

Thanks for your understanding!

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [October 24, 2022, 8:23pm UTC](https://root-forum.cern.ch/t/roofit-plotting-in-jupyroot-6-24/51904/6 "2022-10-24T20:23:21Z")

</div>

Closed on October 24, 2022, 8:23pm UTC

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