[Rivet] make-plots 2.0

Frank Siegert frank.siegert at cern.ch
Wed Sep 3 10:28:06 BST 2014


Hi Andy,
(moving FrankK to bcc to drop him from this technical part of the
discussion, unless he objects, and moving to the Rivet list)

> ASIDE: I occasionally play with ideas of how to do nice, high-quality
> make-plots style output programmatically, but haven't yet found one that
> satisfies me. ROOT is virtually unmitigated crap when it comes to output
> quality, Dave Mallows' dviplot system was technically awesome but I
> can't want to write an entire plotting package from the ground up, and
> pgfplots is too limited. But I've found that matplotlib has a pgf
> rendering backend, which might be the solution to everything: an
> existing full-featured API with TeX-quality output would be ideal. Just
> need a few hours to play with it... or maybe someone else wants to? ;-)

Yes, I think matplotlib is a good direction to move to, but I'll also
ask around for experiences with other plotting packages outside of
ROOT and make-plots.

As far as I understand, matplotlib has three different output modes
capable of creating high-quality PDF output:
(1) the native engine, which supports a large amount of TeX syntax for
mathematical expressions[1]
(2) the regular tex backend, which uses Latex and Ghostscript internally[2]
(3) the pgf backend, which uses XeLaTeX/LuaLaTeX with pgf internally[3]

2 and 3 are significantly slower than 1 (same effect as for
make-plots), so we should really consider whether it's worth using
them. Here is a time+size comparison for 50 fairly simple plots
similar to the ones in the attachment:

(1) plain_demo.py   real 0m9.526s   -> 32Kb per PDF
(2) tex_demo.py   real 1m6.508s   -> 370Kb per PDF
(3) pgf_demo.py   real 0m37.597s   -> 29Kb per PDF

So the decision is basically between 1 and 3. The latter provides the
nice extra option of pgf output which can be directly embedded into a
Latex document. To compare the quality of the three implementations
I'm attaching three PDF files generated from the scripts above. There
are differences, but not necessarily in quality, so maybe we could use
the native rendering by default while still allowing for the pgf
engine for users with more complicated needs.

Cheers,
Frank

[1] http://matplotlib.org/users/mathtext.html
[2] http://matplotlib.org/users/usetex.html
[3] http://matplotlib.org/users/pgf.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plain_demo.py
Type: text/x-python
Size: 1012 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20140903/3d17d273/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plain_demo_0.pdf
Type: application/pdf
Size: 31766 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20140903/3d17d273/attachment.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tex_demo.py
Type: text/x-python
Size: 1000 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20140903/3d17d273/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tex_demo_0.pdf
Type: application/pdf
Size: 378527 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20140903/3d17d273/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgf_demo.py
Type: text/x-python
Size: 1040 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20140903/3d17d273/attachment-0002.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgf_demo_0.pdf
Type: application/pdf
Size: 29615 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20140903/3d17d273/attachment-0002.pdf>


More information about the Rivet mailing list