|
On 10-09-09 02:24 PM, sc2 wrote:
> I am trying to create a shaded bar behind my line graph. It will be
> for economic data and will be used as a "credit freeze" time period
> indicator(gray bars up only). This is much like a recession bar,
> however it isn't when something goes below a certain level on the
> graph, it is specific dates. I am new to matlab, so was wondering if
> anyone could help a damsel in distress?
Probably the easiest way would be to use patch() .
If you are not using the OpenGL renderer, then you can create the patch()
object first and then the line graph to have the line graph be "on top" of the
patch. If that is inconvenient, you could use uistack() to push the patch
below the line graph.
If you _are_ using the OpenGL renderer, then due to an oddity in the way
OpenGL works (in general, not just for Matlab), no matter which order you draw
the items in, OpenGL will always create the line in a particular relationship
to a surface that is in the same plane. That isn't always the order you want
-- and although the order is documented and what you want might happen to be
the documented order, there is a problem that some implementations get the
order exactly backwards. Therefore if you are using the OpenGL renderer, then
the best thing to do is to give the patch a small negative Z so that it will
be "behind" the line graph.
You can force a particular renderer to be used. Sometimes Matlab will
automatically switch to OpenGL (if you have not told it not to); I have not
figured out the circumstances as yet.
You can determine which renderer is being used by commanding
get(gcf,'renderer')
|