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 mplot("datafile.dat",_1,_2,_2).ds(labels).layer("data"); // put another graph showing the data values // with labels. By default, it is not visible // only if you switch on layer 'data'
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
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)