What is BLOP?

BLOP is a script-based plotting utility to create scientific plots in complete harmony with LaTeX documents (see the following text to figure out what it means). I have developed it during writing my PhD to create its figures. Since then it has been almost completely rewritten in order to provide a more flexible way of calculating lengths and to provide full control to the user to accurately position every object in the plot.

Why the name "BLOP"?

The 3 letters L,O,P stand for Latex-Oriented Plotter. However, the word 'lop' in hungarian means 'steal', so I looked for something which sounds better. With the first letter of the alphabet it would be 'ALOP', which also sounds funny. With the second letter of the alphabet it is fine: BLOP! (And this is accidentally also the initial letter of my name.

Why yet another plotting utility?

In scientific communities LaTeX is very often used for typesetting documents. In fact, most journals in physics require the articles to be written using LaTeX. The most common way of including figures in a LaTeX document is to create an .eps file, and include it with the \includegraphics command (provided by the \graphics or \graphicx packages). In order to match the layout of the document, the \includegraphics command provides possibilities to scale the included graphics (in the horizontal and vertical directions separately). However, when scaling an .eps graphics, everything inside the graphics is scaled: fonts, width of lines, etc. So if you produce an .eps file, you have to know its final size at the time of producing it; otherwise you may get too large or too small fonts when scaling it in the document. Moreover, if you apply different scaling factors in the horizontal and vertical directions, the graphics will be distorted (which is especially painful for the texts inside the graphics).

The best quality mathematical typesetter (which I know of) is still TeX, so it is desired that text inside a figure is typeset by TeX/LaTeX. This would make it possible to include any complicated mathematical formula into the figure, without having to learn a new syntax. Moreover, this would make it possible that texts inside a graphics would match the surrounding document in fontsize and fontstyle. Changing the document's fontsize or fontstyle would automatically be reflected in the graphics as well.

I have used gnuplot for creating my plots. Gnuplot's pstricks terminal avoided these problems: it produced a LaTeX macro file, which could be scaled in the horizontal and vertical directions independently, without distortions, and text was typeset by LaTeX. However, since the size of the texts inside the graphics could not be known at the time of producing the figure (since it WILL be typeset by LaTeX, when the figure is included in a document), perfect alignment of the objects in a figure was not possible. BLOP's main goal is to avoid all these problems, and provide the possibility to perfectly align every object inside a graphics, knowing the exact size (in its final look !!!) of each object in advance.

User interface: CINT

BLOP is written in C++. Its user interface is CINT (a C/C++ interpreter). So the syntax of the user's scripts is C++, in which all the classes and functions provided by the BLOP package are usable. Why have I chosen CINT?

A great feature of CINT is the TAB-completion: when running interactively, if you write the first part of the name of an existing variable, or a class, and you press TAB, the word will be completed, if it can uniquely be determined from the given part. If not, pressing TAB twice pops up a list of variables and classes beginning with the given word.

According to the opinion of some people, C++ is not a good language for scripting. Although I partly agree with this, I also believe that it can be really fine if the provided services (set of classes, functions) are well designed. The simplicity and easy-to-write-ness of user scripts was also a main goal in the design of BLOP (it is the task of the users [You!] to decide how it is fulfilled). For example the feature of many scripting languages (Perl, etc), that variables can simultaneously be used as a string or as a double, is imitated in BLOP by the introduction of a new class, var, which provides functions and operators to access, set or modify it as a string or double.


The Author

Name = Dániel Barna