## Plot a data series beneath another one

Tags: plot matlab
Question!

When you plot things in Matlab, the most recently plotted data series is placed on top of whatever's already there. For example:

``````figure; hold on
plot(sin(linspace(0,pi)),'linewidth',4,'color',[0 0 1])
plot(cos(linspace(0,pi)),'linewidth',4,'color',[1 0 0])
``````

Here, the red line is shown on top of the blue line (where they intersect). Is there any way to set "how deep" a line is drawn, so that you can plot things beneath what's already there?

You can also accomplish this by setting the order of the children vector of the current axes. If you do the following:

``````figure; hold on
h1 = plot(sin(linspace(0,pi)),'linewidth',4,'color',[0 0 1]);
h2 = plot(cos(linspace(0,pi)),'linewidth',4,'color',[1 0 0]);
h = get(gca, 'Children');
``````

you will see that h is a vector that contains h1 and h2. The graphical stacking order is represented by the order of the handles in h. In this example, to reverse the stacking order you could do:

``````h = flipud(h);
set(gca, 'Children', h);
``````
By : b3.

In addition i would also suggest:

``````/cars/search/all{?color,model,year}
/cars/search/by-parameters{?color,model,year}
/cars/search/by-vendor{?vendor}
``````

Here, `Search` is considered as a child resource of `Cars` resource.

By : aux

I use two approaches to implement searches.

1) Simplest case, to query associated elements, and for navigation.

``````    /cars?q.garage.id.eq=1
``````

This means, query cars that have garage ID equal to 1.

It is also possible to create more complex searches:

``````    /cars?q.garage.street.eq=FirstStreet&q.color.ne=red&offset=300&max=100
``````

Cars in all garages in FirstStreet that are not red (3rd page, 100 elements per page).

2) Complex queries are considered as regular resources that are created and can be recovered.

``````    POST /searches  => Create
GET  /searches/1  => Recover search
GET  /searches/1?offset=300&max=100  => pagination in search
``````

The POST body for search creation is as follows:

``````    {
"\$class":"test.Car",
"\$q":{
"\$eq" : { "color" : "red" },
"garage" : {
"\$ne" : { "street" : "FirstStreet" }
}
}
}
``````

It is based in Grails (criteria DSL): http://grails.org/doc/2.4.3/ref/Domain%20Classes/createCriteria.html