Prev: pdf.html Up Next: png.html
The x11_ps terminal

Practical Guide:

As its name (x11...) suggests, this is a terminal to display plots on your x11 window system. The second part of the name (..._gv) suggests, that it uses the external program gv (ghostview) to do this. In fact, this terminal is a slightly modified version of blopeps: it does exactly the same job (it prepares the same output file), but then it transforms this file into a normal eps file (using the beps2eps script shipped by blop. The gv program is then automatically launched to display this PostScript file. This has the benefit of

The terminal x11_ps is derived from blopeps, and beyond overwriting some virtual member functions (which the user should not care) it provides some extra services. You can define the width and height of the figure with the following functions:

x11_ps &x11_ps::width (const var &w);
x11_ps &x11_ps::height(const var &h);

The arguments to these functions must be valid LaTeX dimens (for example 5mm, 0.7\linewidth, etc). The produced file will be included with these sizes into the latex document, when transformed to a postscript file. These functions return a reference to the object itself, so they can be changed:

x11_ps x;
x.width("0.7\\linewidth").height("5cm");

The static member function def() returns a reference to a global entity of x11_ps (which is created only at the time of the first call of this function):

static x11_ps &x11_ps::def();

In your daily work you will most often need only one x11 terminal, but in several places in your script. This is the one to be used! In fact, you don't necessarily have to explicitely call this function: the

static void x11_ps::print();

static member function simply prints the current canvas into this global x11_ps terminal. So you only have to call the def() member function if you want to set its dimensions, like in the example below:

x11_ps::def().width("6cm").height("5cm");
plot("datafile");
x11_ps::print();

In fact, the last line in the above example is redundant: whenever a graph, grob, axis (....) is evaluated in interactive cint (that is, if no main function was provided in your script, or if you called blop without a script, so that it waits commands from the terminal, and an expression of the above types is evaluated), x11_ps::print() is automatically called, so it is enough to say only 'plot("datafile");', and voila, the plot will soon appear on your screen.


Source files:
   x11_ps.h
   x11_ps.cc

Prev: pdf.html Up Next: png.html