I have some interpolated ocean data that goes to land. I am thinking to first plot the interpolated values using 'scatter', and then plot the map using 'fill'. But the problem is that, it does not matter which one I plot first, the scatter plot is always on top. My question is how do I bring the scatter plot to back (behind the fill plot)?
No products are associated with this question.
Are you using transparency? Or does
return OpenGL ?
If so then note that OpenGL does not pay attention to the child order: it works in (projected) Z order. It also has rules about what happens if there is a line and a surface in the same plane: the order is determined by the graphic type. I never bothered to remember which order OpenGL defines in this case, as I have encountered graphics driver that get the order exactly backwards.
In the case of OpenGL, you need to make sure that the item that you want to be on "top" has a higher (projected) Z coordinate, closer to the front from the perspective of the viewer. That can involve using scatter3() instead of scatter() and specifying a constant Z coordinate above or below the implied Z=0 of other objects.
The "Children" property of the axis is a list of the handles of the objects on the plot. In general, the order of that list determines the layering.
Here is a simple example where I manipulate the order of that list:
[EDITED in response to comment.]
figure scatter(rand(150,1),rand(150,1)) hold on fill([0.2 0.5 0.5 0.2],[0.2 0.2 0.5 0.5],'r') hg = line([0 0.6],[0.6 0]); set(hg,'LineWidth',12,'Color','g') h = get(gca,'Children'); set(gca,'Children',[h(3) h(2) h(1)])
Play games and win prizes!Learn more