Mistake in the tutorial, root2matplotlib-examples

27 views
Skip to first unread message

Luke

unread,
Oct 30, 2011, 7:09:02 AM10/30/11
to rootplot Users
http://packages.python.org/rootplot/root2matplotlib.html#root2matplotlib-examples
shows the following code:
replacements = [('p_{x}', r'$p_x$'),
('#eta', r'$\eta$')]
hist.bar(color='r', replace=replacements)

This code produced the following error:
Traceback (most recent call last):
File "rootplottest.py", line 18, in <module>
hist.bar(color='r', replace=replacements)
[...]
AttributeError: Unknown property replace

A bit later in the tutorial there is an example which actually works:
replace = [('p_{x}', r'$p_x$'),
('#eta', r'$\eta$')]
hist = r2m.Hist(th1f)
hist.hist(color='r', histtype='stepfilled')
hist.show_titles(replace=replace)

so instead of hist.bar, hist.show_titles has to be used.

Cheers,
Luke

Luke

unread,
Oct 30, 2011, 7:17:29 AM10/30/11
to rootplot Users
That said, it seems that this kind of replacement doesn't do anything.
The titles are still in the form of "p_{x}".

The line should read:
hist.show_titles(replacements=replace)
instead of
hist.show_titles(replace=replace)

On Oct 30, 11:09 am, Luke <lkrec...@googlemail.com> wrote:
> http://packages.python.org/rootplot/root2matplotlib.html#root2matplot...
Reply all
Reply to author
Forward
0 new messages