Prev: plotting-functions.html Up Next: axis-tics.html
Using layers

Practical Guide:
plot(_1,_1);                 // plot by default on layer 'default', which is
                             // switched on by default
mplot(_1,sin(_1)).layer(2);  // put to layer2 (which is OFF by default)
eps::print("test.eps","-L 2");  // print to EPS, switching on layer '2' so that 
                                // the sin is visible (see beps2eps --help)

plot("datafile.dat");        // plot x,y data from file

                             // put another graph showing the data values
			     // with labels. By default, it is not visible
			     // only if you switch on layer 'data'

All graphical objects, and all plottables (graphs, histos, etc) have an associated layer name ("they are on layer X"). By default, frames are on layer 'frame', grid is on layer 'grid', legend is on layer 'grid', and everything else is on layer 'default'. By default all these layers are switched on, but nothing else.

Grobs' (graphical objects) and plottables (dgraph, fgraph, etc) have a member function layer(const var &) to set their layer. These functions return a reference to the object itself, so you can chain them:


This is how you can switch on/off layers other than the default ones

In a LaTeX document:
call the \blopeps macro with the lon=layername or loff=layername options (lon stands for layer-on) optional argument. Apply these arguments several times to switch on/off several layers:
Using beps2eps:
Use the -lon 2,3 -loff grid,legend option to switch on layers 2 and 3, switch off layers 'grid' and 'legend'
From a C++ script/program:
All output formats are created by first producing a beps file, and then transforming it via beps2eps + other conversions. The different terminals' print(filename) functions have a second argument, which holds the command line arguments to beps2eps, for example:
jpg::print("file.jpg","-lon 2,3 -loff grid,legend");

The example section above shows another useful application of layers: graphical representation of some data is often useful, but not sufficient. One would like to know the (x,y) values of the data points. We have now the possibility to store these in the same output file, without disturbing the plot: the data values are plotted with the labels drawstyle, and they are put to another layer, which is invisible by default. You can print it to a .beps file. If you want to quickly visualize the data values, switch the "data" layer on (see the example, blablabla)

Prev: plotting-functions.html Up Next: axis-tics.html